1
$\begingroup$

I believe my problem is similar to this question but I couldn't solve it. After installing the package readstata13, I run the following code in R and it works fine:

data <- read.dta13("D:/Monash/ETC5860 - Research paper/data/Data_Release/conditionfactors_stress_d06302013.dta")

Then I try to do it from Mathematica but it doesn't work:

Needs["RLink`"];
InstallR[];
REvaluate["install.packages('readstata13')"]
Shallow[testdata = 
REvaluate[
"read.dta13('***samepath***/conditionfactors_stress_d06302013.dta')"]]

I get the following:

    Error:could not find function "read.dta13"

Can someone help me fix this? The owner of the aforementioned question said something about not mixing Install[]R with his command but I don't know what that means.

Thanks in advance,

Thad

$\endgroup$
4
  • 1
    $\begingroup$ @Szabolcs, I followed your instructions under Setting up RLink but I get the following error message when I type InstallR["RHomeLocation" ->"C:\\Program Files\\R\\R-3.4.1"]: Error: R.DLL version does not match (DLL:3.4.1, expecting:3.3.0) $\endgroup$ Jun 14, 2018 at 12:02
  • $\begingroup$ I'm sorry, I won't be able to look into that until the weekend (Windows is not my default platform). $\endgroup$
    – Szabolcs
    Jun 14, 2018 at 12:33
  • $\begingroup$ I forgot to REvaluate["library(readstata13)"] in my Mathematica code before REvaluate["read.dta13(...)"]. But Mathematica still doesn't acknowledge the package readstata13. Is there a step that I'm missing after installing a package? Maybe I need to reference the package before using it. $\endgroup$ Jun 23, 2018 at 7:21
  • $\begingroup$ @Szabolcs, I ran InstallR["RHomeLocation" -> "C:\\Program Files\\R\\R-3.4.1"] after running InstallR[]. That's why I got the error message. It works fine now. {;^) $\endgroup$ Jun 23, 2018 at 7:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.