Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not import R packages correctly #30

Open
benleblanket opened this issue Aug 3, 2017 · 2 comments
Open

does not import R packages correctly #30

benleblanket opened this issue Aug 3, 2017 · 2 comments

Comments

@benleblanket
Copy link

I have been trying to use the 'semPlot' package within RCaller's functionality but I am receiving an error that there is no package called 'semPlot', leading to the error that 'semPaths' is an unknown function since 'semPlot' is not imported. I already have the package installed in R and functioning in RStudio. I transferred the code into RCaller to be used. Here is the code I came up with. I happen to be attempting to plot something in this case because that is my ultimate goal but without trying to plot anything, my packages are still not being found:

   `RCode code = RCode.create();

    code.addRCode("x1 <- rnorm(50)");

    code.addRCode("x2 <- rnorm(50)");

    code.addRCode("x3 <- rnorm(50)");

    code.addRCode("x4 <- 2*x1+.3+rnorm(50,sd=.2)");

    code.addRCode("x5 <- 2*x2+.3+rnorm(50,sd=.1)");

    code.addRCode("x6 <- 2*x3+.3+rnorm(50,sd=.3)");

    code.addRCode("data <- data.frame(x1,x2,x3, x4,x5,x6)");

    code.addRCode("data.fact <- factanal(data,3,methods=\"MLE\")");

    File file = code.startPlot();

    System.out.println("Plot will be saved to : " + file);

    code.addRCode("library(semPlot)");

    code.addRCode("semPaths(data.fact, \"est\")");

    code.endPlot();

    rCaller.setRCode(code);

    rCaller.runOnly();

    code.showPlot(file);`

How do you import R packages into RCaller? Also, if there is any difference in procedure for importing into use with RCaller plots, how does that work?

@benleblanket
Copy link
Author

did you try this?
code.addRCode("require('packagename')");

Yes I did try using that code right before the library call, right after the library call, and right before the startPlot (if the placement even mattered beyond placing it before the semPaths() call

@jbytecode
Copy link
Owner

@benleblanket any improvements for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants