Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8157233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:12:42+00:00 2026-06-06T17:12:42+00:00

I need to execute some commands in batch mode (e.g., via Rscript). They work

  • 0

I need to execute some commands in batch mode (e.g., via Rscript). They work in interactive mode, but not in batch mode. Here is a minimal example: sapply(1:3, is, "numeric"). Why does this work in interactive mode but return an error in batch mode? Is there a way to make a command like this work in batch mode?

More specifically, I need to write scripts and to run them in batch mode. They need to call a function (which I didn’t write and can’t edit) that looks like this:

testfun <- function (...)
{
  args <- list(...)
  if (any(!sapply(args, is, "numeric")))
    stop("All arguments must be numeric.")
  else
    writeLines("All arguments look OK.")
}

I need to pass a list to this function. A command like testfun(list(1, 2, 3)) works in interactive mode. But in batch mode, it produces an error: Error in match.fun(FUN) : object 'is' not found. I tried debugger() to get a handle on the problem, but it didn’t give me any insight. I also looked through r-help, the R FAQ, R Inferno, but I couldn’t find anything that spoke to this problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:12:43+00:00Added an answer on June 6, 2026 at 5:12 pm

    Rscript doesn’t load the methods package by default because it takes a lot of time. From the Details section of ?Rscript:

     ‘--default-packages=list’ where ‘list’ is a comma-separated list
          of package names or ‘NULL’.  Sets the environment variable
          ‘R_DEFAULT_PACKAGES’ which determines the packages loaded on
          startup.  The default for ‘Rscript’ omits ‘methods’ as it
          takes about 60% of the startup time.
    

    You can make it load methods by using the --default-packages argument.

    > Rscript -e 'sapply(1:3, is, "numeric")' --default-packages='methods'
    [1] TRUE TRUE TRUE
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I added NSInvocation to a dictionary to execute some commands I need, but I
I need to execute some commands via /bin/sh from a daemon. Some times these
I need to execute some commands on my web server with php configured with
I need execute some code before Windows shutdown process each time. So, I want
I have a bash script which need to execute some php scripts and to
I need to execute the given commands as root and sudo user using Java.
In my MSTest UnitTest project, before running any tests, I need to execute some
Greetings all. I need to get some opinions from those outside of my work
I need to execute some periodic console applications that give me some results (on
I am working on a bash script where I need to conditionally execute some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.