[R] Issue with littler vs. R and source()

peter dalgaard pd@|gd @end|ng |rom gm@||@com
Sat Mar 8 11:15:10 CET 2025


Does Rscript work for you? Seems happy enough here:

Peters-MacBook-Air:~ pd$ Rscript -e 'library(stapler)'
Peters-MacBook-Air:~ pd$ cat > tmp/FailBill.R
library(stapler)
Peters-MacBook-Air:~ pd$ Rscript tmp/FailBill.R 

-pd

> On 7 Mar 2025, at 16.45, J C Nash <profjcnash using gmail.com> wrote:
> 
> I want to use littler (i.e. "r -i ") to run an R script so I can
> set up a clickable icon for a program which uses package staplr.
> Actually to use staplr to consolidate two files and remove some unwanted
> pages before printout.
> 
> A minimal example program is FailBill.R, which has the single line
> 
>  library("staplr")
> 
> staplr is installed, as is rJava. System is Linux Mint 22.1 Xia,
> and I had to install default-jre and default-jdk to get rJava
> installed. Same error came up in a virtual Linux Mint 22 Wilma,
> as I thought recent upgrade to Mint might be the problem.
> 
> Starting R and then doing
> source("FailBill.R")
> works fine.
> 
> But in a terminal
> 
>  r -i FailBill.R
> 
> gives
> 
>  Error: package or namespace load failed for ‘staplr’:
>  .onLoad failed in loadNamespace() for 'staplr', details:
>    call: NULL
>    error: .onLoad failed in loadNamespace() for 'rJava', details:
>    call: dyn.load(file, DLLpath = DLLpath, ...)
>    error: unable to load shared object '/home/john/R/x86_64-pc-linux-gnu-library/4.4/rJava/libs/rJava.so':
>    libjvm.so: cannot open shared object file: No such file or directory
> 
> Almost certainly some setting/pointer is incorrect, but I've yet to find it, and see a
> lot of posts about rJava, offering plenty of confusion.
> 
> Suggestions welcome. Note that the program is interactive, and RScript or similar
> charge ahead and ignore the interactive dialogs that use package svDialogs in the
> program I'm trying to develop. Since I can run in R or RStudio by starting them and
> then source()ing, the situation is not critical, but it would be good to work out
> what is failing.
> 
> John Nash
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business SchoolSolbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-help mailing list