In order to use user input, you need executable script and in case of Linux OS, you are going to provide line
#!/usr/bin/Rscript
at the beginning of your code, and in file properties check executable.
Line that reads actual input is:
a <- readLines(file("stdin"), 1L)
Function readLines accepts argument file("stdin") that is actual standard input, and second argument 1L means that we are going to read only one input line.
Then you can just print your input to the screen like:
message( paste("This is our input: \n", a))
For video tutorial, please check the link below.
No comments:
Post a Comment