1

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/)

MrFlick
  • 195,160
  • 17
  • 277
  • 295
Adam Ryczkowski
  • 7,592
  • 13
  • 42
  • 68
  • I see no `littler` at CRAN. The last version at Dirk E's site is 2 years old. I suggest you contact him directly to see if it's still supported. – Carl Witthoft Nov 21 '13 at 19:12
  • What does `r -e '.libPaths()'` output? – Peyton Nov 21 '13 at 19:55
  • @Peyton nothing. It simply returns nothing. – Adam Ryczkowski Nov 21 '13 at 19:58
  • @CarlWitthoft Yes, you are right. I thought, that when installing it the apt-get showed me, that it was contacting the CRAN server. Apparentely I was mistaken. It must have been downloaded from the Ubuntu Universe repository. – Adam Ryczkowski Nov 21 '13 at 20:24
  • @CarlWitthoft: Of course it is supported. I use it daily; the Ubuntu repo at CRAN gets fresh builds each time R is updated, and the Debian distro has a fine and healthy version too. Please do some checks before spreading misinformation. – Dirk Eddelbuettel Nov 21 '13 at 20:27
  • @DirkEddelbuettel OK but it's not listed as a CRAN package, only hidden deep in the /bin/linux/ubuntu tree. Does this mean that Linux users are expected to use it only via apt-get or other in-system methods? – Carl Witthoft Nov 21 '13 at 20:34
  • Correct. Because it works from /usr/bin or /usr/local/bin where a CRAN package can never install, it never ever was CRAN package. But it drives a number of cronjobs (eg CRANberries) and manual tasks each day. – Dirk Eddelbuettel Nov 21 '13 at 20:37
  • I had this problem just now. I usually use zsh but I had to use bash to get littler to work properly. – Jarrod Urban Feb 10 '15 at 21:06

1 Answers1

0

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.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • 1
    Well, on my system the output is _exactly_ the same. But still the script `library(argparse)` fails with `Error in library(argparse) : there is no package called ‘argparse’`, when the same works well with `Rscript`. If that is relevant, all libraries were installed as admin from `R` (not `r`). Maybe the `littler` stores library files in completely other location. But instalation of any package from within littler fails. – Adam Ryczkowski Nov 22 '13 at 09:15
  • Yes, it does run on Vanilla Ubuntu 13.10 with no problems; no luck with vanilla Mint 15. I will send a bug then. Do you have any idea of what might be the source of the problem? The R itself works fine on Linux Mint 15. – Adam Ryczkowski Nov 22 '13 at 15:10
  • It would appear that the prebuilt version of littler on Mint is buggy. So install littler from source. – Dirk Eddelbuettel Nov 22 '13 at 15:27