I've written out codes for one particular file, and now I want to generate the same kind of graphs and files for the rest of similar data files, I wrote commands as the following, however, it doesn't work... When I plugged in these codes, R produced only one plot for the file "eight", and it states my error(see below) I have edited and checked my codes so many times but still couldn't figure out what's wrong with it...would you please help me?
I really really appreciate your help!
my.files <- list.files()
for (i in 1: length(my.files)) {
temp.dat <- read.csv(my.files[i])
eight <- read.csv(file="8.csv", header=TRUE, sep=",")
eightout <- subset(eight, inout=="Outgoing from panel hh" & o_duration>0, select=c(inout, enc_callee, o_duration))
f <- function(eightoutf) nrow(eightoutf)
eightnocalls <- ddply(eightout,.(enc_callee),f)
colnames(eightnocalls)[2] <- "nocalls"
eightout$nocalls <- eightnocalls$nocalls [match(eightout$enc_callee, eightnocalls$enc_callee)]
eightout=data.frame(eightout,"time"=c(1:nrow(eightout)))
M <- plot(eightout$time,eightout$nocalls)
pdf(paste(Sys.Date(),"_",my.files[i],"_.pdf", sep=""))
plot(temp.dat$time, temp.dat$nocalls, main=my.files[i])
dev.off() }
This is what R says Error in plot.window(...) : need finite 'xlim' values In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf 3: In min(x) : no non-missing arguments to min; returning Inf 4: In max(x) : no non-missing arguments to max; returning -Inf
temp.dat
but then doesn't appear to use it for any of the subsequent manipulations. I'm afraid I'm out of time and patience for this one ... sorry ... – Ben Bolker