Back

Explore Courses Blog Tutorials Interview Questions
+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
edited

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!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...