+1 vote
2 views
in R Programming by (3.5k points)
edited by

I have file called q.r and it has chmod of 755, how can I run it using a command-line?

sayHello <- function(){
   print('hey')
}
sayhey()

1 Answer

0 votes
by (25.3k points)
edited by

To run an R script file directly from the UNIX command line, and print the output to the terminal, use the following command:

Rscript q.R

Note: The Rscript by default does not load the methods function. In order to load the methods function if your code relies on it, please load it explicitly on your script.

If you want to learn more about R programming watch this tutorial on Introduction to Data Science with R 

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...