[R] re ad.table() and setwd() in unix batch mode
tbigdeli
tbigdeli at gmail.com
Fri Jun 19 18:33:48 CEST 2009
My apologies for being overly brief before..
I submit an R script to batch mode as follows:
a list of files (object = 'files'). In each iteration, the next file is
read, alterations made, working directory changed, and output file written
out. R will take an inordinate amount of time processing the first file,
after which no files seem to be read-in. For batch mode, are my paths
inappropriate? Thanks!
setwd("/home/bigdelitb/chr20/merlin/sim/d5/ped")
files<-read.table("d5.rf.list",stringsAsFactors=FALSE)
for(i in 1:length(files$V1)){
setwd("/home/bigdelitb/chr20/merlin/sim/d5/ped")
count <- 1
name<-files$V1[i]
ped <- read.table(name,header=FALSE,stringsAsFactors=FALSE)
...
...
setwd("/home/bigdelitb/chr20/merlin/sim/d5/ped/pdt/")
write.table(ped,name,quote=FALSE,..)
}
Uwe Ligges-3 wrote:
>
>
>
> tbigdeli wrote:
>> I continually receive the error
>>
>> Error in file(file, "r") : cannot open the connection, when running in
>> batch
>> mode, but not when inputing directly into R.
>
> Have you given the full path name?
> If not, do you start both R instances from the same working directory?
>
> Otherwise, do you have the same credentials in both cases?
>
> Uwe Ligges
>
>
>
>
>
>>
>> Any ideas?
>>
>> Thanks!
>>
>> TB
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://www.nabble.com/read.table%28%29-and-setwd%28%29-in-unix-batch-mode-tp24107008p24114888.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list