search for: fac_

Displaying 1 result from an estimated 1 matches for "fac_".

Did you mean: fac
2011 Jun 28
0
time series question
...26)) DF[as.numeric(rownames(DF)) %% 3 == 0,"Val"] <- NA # make some holes DF2 <- cast(melt(DF, id=c("Var", "Year")), ... ~ variable + Year, fun=mean, na.rm=T) # my attempt library(reshape) prev <- grep("Val_", names(DF2)) - 1 this <- grep("Fac_", names(DF2)) DF3 <- DF2 DF3[, prev] <- mapply("*", DF2[, this], DF2[, prev]) This doesn't work. Another option would be to use two loops for cols and rows, but I didn't get that to work either :-( Suggestions for clean code, anyone? Thank you in advance! Cheers!...