I have a simple script foo.R
, and inside it a single line:
library("argparse")
When I invoke the script from the bash shell I got the following error:
$r foo.R
Error in library("argparse") : there is no package called ‘argparse’
OTOH, when I invoke Rscript, everyting seems fine:
$ Rscript foo.R
Loading required package: proto
Why the difference? The littler README says nothing about problems with loading libraries.
I use 64 bit Linux Mint 15 (based on Ubuntu 13.04) with R
(R version 3.0.2 (2013-09-25)) and littler
(version 0.1.5) installed from Ubuntu universe apt repository (e.g. http://ftp.acc.umu.se/ubuntu/ubuntu/pool/universe/l/littler/)
Your system it confused. Here littler works just like a charm:
edd@max:~$ r -e'print(search())'
[1] ".GlobalEnv" "Autoloads" "package:base"
edd@max:~$ r -lMASS -e'print(search())'
[1] ".GlobalEnv" "package:MASS" "package:utils"
[4] "package:stats" "package:graphics" "package:grDevices"
[7] "Autoloads" "package:base"
edd@max:~$ r -lRcpp -e'print(search())'
[1] ".GlobalEnv" "package:Rcpp" "package:methods" "Autoloads"
[5] "package:base"
edd@max:~$
I don't know about Mint, but you could try the Ubuntu repo at CRAN and get a pre-built littler. Else just fetch the tarball and build it -- takes under a minute. It does hardcode some configuration-time paths into the binary so the Mint build could be at fault.
On Debian and Ubuntu, however, everything is as it should be.