[R] What's wrong with my code?

Susie susiecrab_ling at hotmail.com
Tue Jul 12 17:15:29 CEST 2011


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.

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? Thanks!


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)))
plot(eightout$time,eightout$nocalls)
write.csv(eightout, "eight.csv", row.names=FALSE)	
pdf(paste(Sys.Date(),"_",my.files[i],"_.pdf", sep=""))
plot(temp.dat$time, temp.dat$nocalls, main=my.files[i])
dev.off() 
write.csv(temp.dat, paste(Sys.Date(),"_",my.files[i],"_.csv", sep=""),
row.names=FALSE)
}


R says:
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

--
View this message in context: http://r.789695.n4.nabble.com/What-s-wrong-with-my-code-tp3662579p3662579.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list