I am writing a small function giving a combined conditional density and an empirical cumulative distribution graph.
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)
}
It works great, however, when I try to swing it, I was lucky everything ...
<<fig1,fig=T>>=
par(mfrow=c(1,2))
print(cdpl(tre,A,B))
print(cdpl(tre,A,C))
@
Sweave ("re.rnw") Writing to re.tex file Processing code fragments ...
1: echo term verbatim eps pdf (label = fig1)
Error: piece 1 (label = fig. 1) Error in model.frame.default (formula = dep ~ indep): invalid type (list) for variable 'dep'
How can this be when it works great outside the sweave?
// M
source
share