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

  • SEARCH
  • Home
  • 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 8451297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:12:02+00:00 2026-06-10T11:12:02+00:00

My Problem: I have an R script myscript.R that uses a configuration file, e.g.

  • 0

My Problem:

I have an R script myscript.R that uses a configuration file, e.g. config.xml, what is the best way to submit such a script to a job scheduler (e.g., using qsub)?

I would like to be able to use the script and file in the same way that I would use, e.g., a C or Fortran executable, which is embedded in a bash script.

How I currently use FORTRAN:

Here is an example of the approach that I use with a compiled Fortran executable fex like the following that I will call fscript.sh:

!#/bin/bash/
mpirun [arguments] "fex" -f $1

The above fscript.sh can be sent to a cluster with instructions to read the config file like this:

qsub [arguments] fscript.sh 1 config.xml

How I currently use R in an analogous way:

To run R in an analogous way, I am using a bash script rscript.sh

#!/bin/bash
CONFIG=$1
env $CONFIG R --vanilla < myscript.R

This can be run at the command line, e.g.

qsub [arguments] rscript.sh config.xml

Where the rscript.R contains something like

library(XML)
config <- Sys.getenv("CONFIG")
config <- xmlList(xmlParse(config.xml))
myfunction(config)

My Questions

  1. Would Rscript or compiler provide a more robust approach than my current use of bash?
  2. Under which conditions would one be more appropriate than the other (What are the pros and cons)?
  3. How would I pass a configuration file in either case?

What I have done so far

In addition to coming up with the bash script rscript.sh described above, I have read through tutorials and some documentation for Rscript and compiler, but it is not clear to me if these are the contexts in which one would be preferred over the other. Also, it is not clear the best way to pass a configuration file in either context.

This questions is related to others, e.g., What are the ways to create an executable from R program, Does an R compiler exist?. However, I do not think that is essential to use compiled code.

  • 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-10T11:12:04+00:00Added an answer on June 10, 2026 at 11:12 am

    What does compiler have to do with anything? It compiles R code into byte-code for the R interpreter so it may not do what you suspect.

    For scripting, use Rscript (available everywhere), or littler (which predates Rscript).

    We actally wrote littler explicitly for this scripting purpose and my “Intro to HPC with R” talks (see the presentations page) actually have examples of submitting such script to the slurm scheduler / resource managers (as I never had access to qsub).

    There are many other questions here relating to Rscript and command-line parsing. That should get you started.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a really weird problem with /bin/bash and a script that uses printf
I have problem with php script. The thing is that it shows me, that
I need to manage a configuration file in Linux using a shell script, that
I have a interesting problem, my script uses ssh to access my vmware server
i have a script that posts the id's onto a page, the only problem
The problem I've got is that I have a Python script that encodes about
I have python script that uses pysvn and checks out or updates a local
I have a php script that uses Doctrine2 and Zend to calculate some things
I have a simple image upload script that uses SimpleImage.php (http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/) to resize and
I have a script in php that writes XML. I use an ajax call

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.