R - Command line arguments and user keyboard input

Опубликовано: 19 Май 2026
на канале: Multilingual Programming
261
like

Video Chapters (table of content with clickable links into a specific part of the video)
00:00 Introduction about the video content
00:42 Prerequisites (you should have some programming skills in at least some language)
01:08 Command prompt (showing the installed R version)
01:19 Showing the interactive R console
02:40 Showing that I am starting from an empty directory and starts Visual Studio Code
02:57 Creates an R file with a "Hello World" script
03:21 Executes "Hello World"
03:29 Replaces the implementation with code receiving arguments from the command line and the keyboard
10:11 Executes (as RScript) the script receiving arguments from the command line and the keyboard
11:28 Executes (from the R console) the script receiving arguments from the command line and the keyboard


Please note that you can choose to show english subtitles for the videos.

Currently (when this video was published) there are not many videos in the below playlists but please remember to subscribe to this channel if you think you are interested in future videos which will become added to the play lists.

Playlists for "Program arguments from command line and keyboard input" for different programming languages:
Playlist for the videos with english voice and english subtitles:
   • Program arguments from command line and ke...  
Playlist for the videos with swedish voice and swedish subtitles:
   • Program argument från kommandoraden och in...  

R playlist (english):
   • R - Command line arguments and user keyboa...  
R playlist (swedish):
   • R - Program argument från kommandoraden oc...  


R
https://www.r-project.org/
https://en.wikipedia.org/wiki/R_(prog...)

R Language Definition
https://cran.r-project.org/doc/manual...


The R version used in the video is 4.2.0 but some links below leads to version 3.6.2 since that seem to be the latest version with documentation pages currently available.
( See for example the github issue 'Add pages for R4.0.5/ R4.1.0 ' https://github.com/datacamp/rdocument... )

RScript
https://www.rdocumentation.org/packag...

R CMD BATCH
https://www.rdocumentation.org/packag...

Function 'c' creates a vector
https://www.rdocumentation.org/packag...

Function 'cat' prints text to the screen
https://www.rdocumentation.org/packag...

Function 'commandArgs' with the argument 'trailingOnly'
https://www.rdocumentation.org/packag...

Function 'readLines' can read input from the keyboard
https://www.rdocumentation.org/packag...

Function 'readline' can read input from the keyboard
https://www.rdocumentation.org/packag...

Function 'interactive'
https://www.rdocumentation.org/packag...


'for loops'
https://cran.r-project.org/doc/manual...


'How to pass command-line arguments when calling source() on an R file within another R file'
(stack overflow page, shown in the video at the time 11:45)
https://stackoverflow.com/questions/1...