dlply() gives me an error: "Object '...' not found" when I try the smooth.spline() function with it. The example below creates some data and shows how "lm" will work but "smooth.spline" won't. Note that I am doing some arithmetic in the function arguments but that's not the reason for the error.
#some data:
df <- data.frame(count=rep(1:5,2),VSS=runif(10,0.45,0.55),
TSS=runif(10,0.9,1.3),sl=c(rep("a",5),rep("b",5)))
#works:
dlply(df,.(sl),lm,formula=VSS/TSS~count)
#doesn't work:
dlply(df,.(sl),smooth.spline,x=count,y=VSS/TSS,all.knots=TRUE)
#output:
Error in xy.coords(x,y) : Object 'VSS' not found
Any ideas???