[R] problem with Rscript

m.u.r. mmuurr at gmail.com
Wed Mar 25 15:59:42 CET 2009


Well I located the error and it had to do with an existing .RData file
that had a print method defined for a class which is part of a package
that wasn't loaded.  Starting an interactive session, removing the
objects of the specialized class from the top-level environment, and
re-saving the environment permitted the Rscript to run correctly.  I
suppose similarly if the script loaded the package it would've run
also.

Thanks to all for the emails with suggestions.


On Mar 24, 7:10 pm, "m.u.r." <mmu... at gmail.com> wrote:
> Hi all, this is probably some tricky configuration file problem, but I
> figure someone here might have come across this in the past:
>
> In short, I've been using Rscript to run my scripts, usually
> successfully.  But recently I've run into a strange problem, and the
> only function that causes an error is "print".
>
> I can create a file that contains only a print command, and it causes
> an error.   Here is a test file, called "test.R":
>
> print(69)
>
> That's it, just the single print line in the file.  Now, when I try to
> execute this file using Rscript (using the same flags I've used
> successfully in the past):
>
> Rscript --restore --no-save test.R
>
> I get this error:
>
> Error in print(69) : could not find function "loadMethod"
> Execution halted
>
> This problem seems to be isolated to Rscript, not R, as the following
> command works just fine:
>
> R --restore --no-save < test.R
>
> has anyone ever seen anything like this with Rscript?  And maybe shed
> some light on why "loadMethod" can't be found when starting R via
> Rscript?
>
> Thanks,
>
> Murat
>
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list