rstudio - R system2 trouble invoking R script on windows -
i use rodbc connect microsoft access databases , can in 32-bit r because 32 bit ms office loaded on windows 7 pc.
after extracting data ms access database in 32-bit r, want manipulate , analyse in 64-bit r. in addition trying write script others may need use , simplify things invoking 32-bit r inside rstudio (which have set use 64-bit r, version 3.1.2).
i found this post seemed looking , attempted run suggested code. however, gives me fatal error indicating working directory not exist, though have been working directory within 64 bit r , 32 bit r , without rstudio , have never had problems:
> system2("c:\\users\\joe.bloggs\\documents\\r\\r-3.1.2\\bin\\i386\\rscript.exe", normalizepath("my script.r", winslash = "\\", mustwork = true), invisible=false) fatal error: cannot open file 'h:\03.': no such file or directory warning message: running command '"c:\users\joe.bloggs\documents\r\r-3.1.2\bin\i386\rscript.exe" h:\03. b project\my script.r' had status 2
note have installed r , rstudio in "documents" folder in c drive since don't have administrative rights.
also, r script on network drive (h).
i have tried copying r script want run default working directory of 32-bit r on c drive , explicitly stating filepath without using normalizepath (as assume command expands current working directory in 64-bit r), gives same error above.
further, if try invoke 32-bit r, warning:
> system2("c:\\users\\joe.bloggs\\documents\\r\\r-3.1.2\\bin\\i386\\rscript.exe", invisible=false) usage: /path/to/rscript [--options] [-e expr [-e expr2 ...] | file] [args] --options accepted --help print usage , exit --version print version , exit --verbose print information on progress --default-packages=list 'list' comma-separated set of package names, or 'null' or options r, in addition --slave --no-restore, such --save save workspace @ end of session --no-environ don't read site , user environment files --no-site-file don't read site-wide rprofile --no-init-file don't read user r profile --restore restore saved objects @ startup --vanilla combine --no-save, --no-restore, --no-site-file --no-init-file , --no-environ 'file' may contain spaces not shell metacharacters expressions (one or more '-e <expr>') may used *instead* of 'file' see ?rscript within r warning message: running command '"c:\users\joe.bloggs\documents\r\r-3.1.2\bin\i386\rscript.exe"' had status 1
any insights doing wrong appreciated; tried using single forward slashes instead of double slashes in both file paths no avail; still got same error.
how can system2 locate r script , run in 32-bit r?
also there resource explains status numbers in warnings mean?
many help.
i've been trying same thing (call 32 bit r 64bit rstudio rodbc) , asked similar question here. used different approach , did:
system(paste0(sys.getenv("r_home"), "/bin/i386/rscript.exe h:\\path\\to\\file.r"), wait = false, invisible = false)
Comments
Post a Comment