I have translated the Python lesson on Command-Line Programs to R. It is ready for review. To properly compare these lessons, you'll need to locally build the R lesson, which you can accomplish by running the code below:
# clone bc repo
git clone git@github.com:swcarpentry/bc.git
# create and switch to new branch
git checkout -b review-pr
# add remote
git remote add jdb git@github.com:jdblischak/bc.git
# pull changes from my branch
git pull jdb 06-cmdline
# build site locally
make site
Then compare the rendered files _site/novice/r/06-cmdline.html and _site/novice/python/06-cmdline.html.
The main translations involve:
Use commandArgs(trailingOnly = TRUE) to replace sys.argv for reading in command-line arguments
Use file("stdin") to replace sys.stdin for reading from standard input
Use cat(vec, sep = "\n") to replace for m in values: print m for writing to standard output
I have translated the Python lesson on Command-Line Programs to R. It is ready for review. To properly compare these lessons, you'll need to locally build the R lesson, which you can accomplish by running the code below:
Then compare the rendered files _site/novice/r/06-cmdline.html and _site/novice/python/06-cmdline.html.
The main translations involve:
commandArgs(trailingOnly = TRUE)
to replacesys.argv
for reading in command-line argumentsfile("stdin")
to replacesys.stdin
for reading from standard inputcat(vec, sep = "\n")
to replacefor m in values: print m
for writing to standard output