Call shell skript with specific working directory from R -
i have sh script, can run specific directory because looks files in directory , don't want change sh file.
suppose file in ./sub/script.sh
, r working directory ./
what works is
wd = getwd() setwd("./sub") system2("./script.sh") setwd(wd)
but find rather unhandy. how can without changing r working direcotry?
this isn't pretty, job
# function call script test <- function(){ # current working directory cur <- getwd(); # on exit, come on.exit(setwd(cur)); # change directory setwd("~"); # run command system("pwd"); # return null }
then call function test()
.
Comments
Post a Comment