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

J C Nash pro|jcn@@h @end|ng |rom gm@||@com
Sat Mar 8 13:24:07 CET 2025


Thanks for responses.

R CMD r -i ./FailBill.R

And, better, the approach seems to allow the full program to run the
dialogs (from svDialogs package) I need for interaction. I'll have to
see how well I can make that work in a clickable icon.

Rscript ./FailBill.R

does avoid the "error" in not finding the java VM. However, and
unfortunately for me, Rscript on the full program ignores the dialogs, but
keeps going taking whatever is first option in the dialog call. I've not
sorted out why that is, but believe it is why littler was set up. Despite
quite a lot of R programming, I've not much experience in interactive programs
that go beyond simple 'readline' statements.

In any event, Steve's suggestion has got me moving forward. I suspect there'll
be other glitches to work around, especially as my intent was to obtain a
program that was cross platform. I had been using YAD in Linux, which is nice,
but leaves out Windows and Mac users.

Thanks again.

JN

On 2025-03-07 23:02, Steve Martin wrote:
> Hi John,
> 
> Does it work if you run R CMD r -i FailBill.R?
> 
> Steve
> 
> 
> -------- Original Message --------
> On 3/7/25 10: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.
>>



More information about the R-help mailing list