Dear R users, I have problems handling missing values. THe problem is that after running my codes the result I get just skips the missing values. What I want is for the missing values to appear in my results as well. I have put a workable example below and as you could see the missing value in x1 (the 18thh value) does not appear in the list y.fitted.
Any help appreciated Regards, minti library(mgcv) y.list <- list(y1=runif(10), y2 <- runif(10), y3 <- runif(10)) y.list <- list(y1=runif(20)) x1 <- 1:20 x2 <- c(11, 15, 17, 2, 18, 6, 7, NA, 12, 10,21, 25, 27, 12, 28, 16, 17, NA, 12, 10) y.gam <-lapply(y.list, function(y)gam(y~s(x1,x2, k=10))) y.fitted <- lapply(y.gam, fitted) # list of fitted values ______________________________________________ R-help@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.