I am not able to get spm function in SemiPar to work with plyr. Here's an 
example:

========================================
library(plyr)
library(SemiPar)

data <- data.frame(id=c(rep("111",100),rep("222",200)), 
value=c(rnorm(100,2,1),rnorm(200,10,5)))

#this works
data111 <- data[data$id=="111",]
spm111 <- spm(data111$value ~ f(1:nrow(data111)))
data222 <- data[data$id=="222",]
spm222 <- spm(data222$value ~ f(1:nrow(data222)))

#this does not work
d_ply(data, c("id"), function(x) {
    spmx <- spm(x$value ~ f(1:nrow(x)))
})
========================================

Error in eval(expr, envir, enclos) : object 'x' not found

______________________________________________
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.

Reply via email to