kreutz-lab / Rcall

R function interface for Matlab
BSD 3-Clause "New" or "Revised" License
23 stars 4 forks source link

Trouble with example code #6

Closed apkaye closed 2 years ago

apkaye commented 2 years ago

Hello,

Thank you for sharing this package! I'm having some trouble with some simple example code. My code and the output are below. I'm using Matlab R2021a and R 4.2.0. Do you have any suggestions?

image image

I think the R path is correct - that folder exists. Here are the contents of /Library/Frameworks/R.framework/Resources/ image

clemenskreutz commented 2 years ago

I have made an attempt to solve this issue. Please update the code and check again.

apkaye commented 2 years ago

Hi,

Thank you for the quick response! I'm getting a new error:

Screen Shot 2022-05-18 at 2 44 02 PM
clemenskreutz commented 2 years ago

Can you check, whether the command printed in the message "/Library/Framework/R.framework/Resources/R" CMD BATCH --slave "/Users/aaronkaye/Documents/EconResearch/Expedia/Analysis/matlab/Rrun.R" works when you paste this to the command line (e.g. bash/shell/Windows Command Prompt)?

How do you have to change the command in order to get it run?

Which operating system do you use?

apkaye commented 2 years ago

hi - I am getting an error no such file directory

I'm using a mac with version 12.3.1.

Screen Shot 2022-05-19 at 10 43 06 AM

the file directory obviously exists though. Screen Shot 2022-05-19 at 11 29 17 AM

clemenskreutz commented 2 years ago

Maybe it is a problem that "R" is an "Alias", i.e. shortcut (see screenshot above). Maybe you try to call the target of the Alias directly?

apkaye commented 2 years ago

Thanks again for the help.

Okay - I update the file path for R, seems like '/usr/local/bin/R' or '/Library/Frameworks/R.framework/Versions/4.2/Resources/bin/R' get me further. I'm getting the following error in the command line:

MacBook-Pro:/ aaronkaye$ "/Library/Frameworks/R.framework/Versions/4.2/Resources/bin/R" CMD BATCH --slave "/Users/aaronkaye/Documents/Econ Research/Expedia/Analysis/matlab/Rrun.R"

/Library/Frameworks/R.framework/Resources/bin/BATCH: line 60: Econ
Rrun.R
.R.Rout: Read-only file system
apkaye commented 2 years ago

Hi Again,

I think there is a bug dealing with file paths that have a spaces. My current directory (in matlab) is

/Users/aaronkaye/Documents/Econ Research/Expedia/Analysis/matlab

If I remove the spaces, Rcall now works. Here is the error that tipped me off:

Screen Shot 2022-05-20 at 2 43 37 PM