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

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -