I am trying to run an executable script from within RStudio. The script runs perfectly from Terminal, however, when trying to run it form within R I get the following error message:
setwd("/users/admin")
command <- "/users/admin/Test_script.command"
system2(command)
> lib/Bio/DB/HTS/Faidx.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xc500080)
I am running MacOS X Big Sur and I use perlbrew with perl version 5.26.2, I guess the problem is that RStudio tries to use my system perl version - but I couldn't find a way to change that…
Any ideas? Thanks!
I found a way to get it running by looking into the actual script, which is perl based. Then I was able to solve the problem by following the answer to https://stackoverflow.com/a/65553736/4253357 as Michal suggested. Thanks again for your help!
Related
I install R-4.1.1arm64 on m1 Mac.
When I type R in the terminal, it creates an error
Besides, when I use the Rscript command it will also generate the error.
I am not familiar with programming. Could anyone tell me a clear way to fix it?
Thanks, guys.
Well, no problem now. I just delete the file ".Rprofile" and install the package "languageserver".
I'm using system command in R for invoking an OS command. The problem is that my OS command works only when I use it as administrator from the shell. How I can work from R as administrator?
Using simply system(command) access to files is denied. How I can solve? Thank you!!
I solved just clicking on R icon and runned it as adminstrator!
I've been learning R Markdown for the past months. It was fairly easy to get Anaconda Python to run within a R Markdown script, but I haven't yet found a way to get to run chunks of bash code within the same document.
Using
```{bash}
echo hello world
```
I get the error message
/bin/bash: C:\Users\MyName\AppData\Local\Temp\Rtmp0MpNfS\chunk-code-4cbc213a3545.txt: No such file or directory
Might any of you guys know what might be the root of this problem?
I know maybe is to late but I had the same problem and I find the solution.
First, in Windows 8.1 or if you don´t have the Windows Subsystem for Linux (WSL) you can install Cygwin: https://cygwin.com/ > Install Cygwin
This is the recommendation pointed out in R Markdown: The Definitive Guide (https://bookdown.org/yihui/rmarkdown/) > 2.7 Other language engines > 2.7.2 Shell scripts
Second, add Cygwin to the PATH. Usually Cygwin is installed in C:\cygwin64 and the path to include will be in this case C:\cygwin64\bin
Third, check that everything is correct using base::Sys.which("bash") in R
If everything is correct it will appear something like this "C:\\cygwin64\\bin\\bash.exe"
Fourth, you can run in a Rmarkdown document, the chunk that you pointed out to double check:
```{bash}
echo hello world
```
I have been trying to execute a simple test.R
setwd("C:\Users\jdd\Documents")
test <- 2*6598
filename = "test.csv"
write.csv(test,file=filename)
Via the following command line command in Windows:
"C:\Program Files\R\R-2.15.2\bin\R.exe" CMD BATCH --vanilla --slave "C:\Users\jdd\Documents\test.R"
When I execute this I get the following error:
The system cannot find the path specified.
I have been trying to work out a solution on the basis of the provided error message, but failed so far. Wondering if somebody can help me so I can execute the script directly from the command line. Thanks
Thanks #sebastian-c! I tried to use RScript, which I investigated before. However, the problem was a different one. Appears that in my installation there is a R.exe and Rscript.exe file in .\bin, but also one in .\bin\x64. The first one is not working properly, but the second one is. The comment made by #Roland is very important as well, since once working I got this error message!
The following command did the job:
"C:\Program Files\R\R-2.15.2\bin\x64\Rscript.exe" "C:\Users\jdd\Documents\test.R"
and the corrected text.R is:
setwd("C:\\Users\\jdd\\Documents")
test <- 2*6598
filename = "test.csv"
write.csv(test,file=filename)
As mentioned here, it might has something to do with 64bit version of R.
The problem is that Rscript.exe itself is attempting to access a missing file on the system. The obvious fix is explicitly add 'x64' to the path of the other Rscript.exe that was installed:
"C:\Program Files\R\R-2.15.2\bin\x64\Rscript.exe" --version
R scripting front-end version 3.0.2 (2013-09-25)
I'm working in windows box, and using cygwin to imitate unix shell. Also I have R and want to run any system comand from it. I believe that system('command') would do this, but it didn't work for each 'command'. For example system('ls') returns /cygdrive/c/cygwin/bin/ls: write error: Bad file descriptor and I think that this is beacause R calls ls >& - which also returns same error. So how solve this problem?
I hope you are still interested in a solution. Here is what I have:
Start R from Windows and call cygwin executable by path: system('C:/cygwin/bin/ls.exe');
Start R from within cygwin:
Start cygwin
Set path: export PATH="$PATH:/cygdrive/c/Programme/R-2.9.2/bin"
Call R: Rgui.exe
Call shell: system('ls')
Regards,
Martin.