i am trying to pass external arguments to R when calling a Rscript with a command line in that i am getting an Error in setwd(args[8]) : cannot change working directory Execution halted
Not sure why this error is occurring Please suggest some ideas to sort out
Any idea would be appreciated
Rscript /home/mike/learn-analysis/SL_input.R chr21 10542449 10542649 + Y Y 1 /mnt/prep/learn/CA-21-10542394-10542448.2.D.txt D /home/mike/learn-analysis/SL_table.R
#SL_table.R file
args <- commandArgs(trailingOnly = TRUE)
setwd(args[8]) # directory to write file to
source(args[11]) # can be updated to reflect location of source code
results<-SL_mutate(args[1],args[2],args[3],args[4],args[5],args[6],args[7]) # chrom, start, stop, strand, gene, transcript, exon number
results$type<-args[10]
results$transcript<-NULL
results$exon_num<-NULL
write.table(results,args[9],quote = F, row.names = F, sep="\t") # write to filename given in argument (in working directory)