[R] problem with substitute
R. Heberto Ghezzo
heberto.ghezzo at mcgill.ca
Thu Jul 18 17:17:08 CEST 2002
Hello, I have a data base with variables pasthma,kasthma,sex,etc.
I wrote a program to compute the Kappa statistic between pasthma and
kasthma.
Actually "did the child had asthma" answered by the parents and by the
child.
kappa <- function(x) {
r <- paste("p",evaluate(x),sep="")
c <- paste("k",evaluate(x),sep="")
a <- table(r,c)
...
}
If I call "kappa(asthma)" it works as expected ( "by me"). But if I call
"kappa(asthma[sex==1])" it does not because of evaluate
r is "p[" "pasthma" "psex==1" and I intended to be "pasthma[sex==1]"
Is there a way around, or I am using the wrong approach?
Thanks for any help
.
Heberto Ghezzo Ph.D.
McGill University
Montreal - Canada
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list