1

Lets say I have the following script

k <- as.numeric(readline("Start Index: "))
tot <- NULL

for (i in 1:k){
    tot <- c(tot, i)
}
write.csv(tot, "test.csv")

I would like to run this script from the command line. How can I run it so that it still asks for the user input (k). Or otherwise can I add the value of k in the CMD command as argument? I am on Linux.

1
  • couple of these floating around link, link, link, link, link Commented Jun 22, 2012 at 21:59

1 Answer 1

1

You might find the information in ?commandArgs helpful.

From the description:

 Provides access to a copy of the command line arguments supplied
 when this R session was invoked.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.