
Hi all,
 
I am trying to run a code using the function "tapply", and after test it and see that the value is atomic, when I run the script it gives an error:
 
Error in sort(unique.default(x), na.last = TRUE) :         'x' must be atomic
for (i in 1:50){
year.name <- paste("year",i,sep="")
year.tmp <- rep(x=periodtime[i], each=length(period[i]))
assign(year.name,year.tmp)
 
grab.p <- get(paste("period",i,sep=""))
daf <- data.frame(year.name, grab.p, value=rnorm(length(year.name)))
repl <- tapply(daf$value, daf$period, mean, na.rm=T)
not <- which(is.na(daf$value))daf$value[not] <- repl[daf$period[not]]
data.frame(xtime, daf$value[not])
}
 
Where is the error if x is atomic?
 
 
All the best,
 
Laura
_________________________________________________________________


	[[alternative HTML version deleted]]

