Dear all,
I´m writing up a small function giving a combined conditional density and empirical cumulative distribution plot.
cdpl<-function(df,dep,indep){
attach(df)
cdplot(dep~indep,xlab=deparse(substitute(indep)),ylab=deparse(substitute(dep)))
g<-indep
ec<-ecdf(indep)
lines(knots(ec),as.numeric(names(table(ec(g)))),col="red",lw=3)
detach(df)
}
This works fine, however when I try to sweave it my luck is all out...
<<fig1,fig=T>>=
par(mfrow=c(1,2))
print(cdpl(tre,A,B))
print(cdpl(tre,A,C))
@
Sweave("re.rnw") Writing to file re.tex Processing code chunks ...
1 : echo term verbatim eps pdf (label=fig1)
Error: chunk 1 (label=fig1) Error in model.frame.default(formula = dep ~ indep) : invalid type (list) for variable 'dep'
How can this be when it works allright outside sweave?
//M