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

Popular posts from this blog

Lists in Python -

android - can not access to progress bar in an other activity -

html - Not able to access next element of an array javascript -