The purpose of the scriptexec package is to enable quick and easy way to execute native scripts.
library(scriptexec)
#execute script text
output <- scriptexec::script_execute('echo Current Directory:\ndir')
#> arguments 'minimized' and 'invisible' are for Windows only
cat(sprintf('%s\n', output))
#> NULL
#> c("Current Directory:", "scriptexec.R scriptexec.Rmd")
#execute multiple commands as a script
output <- scriptexec::script_execute(c('cd', 'echo User Home:', 'dir'))
#> arguments 'minimized' and 'invisible' are for Windows only
cat(sprintf('%s\n', output))
#> NULL
#> c("User Home:", "R apache-maven-3.3.9 che entrypoint.sh group.template passwd.template tomcat8")