<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4807.2300" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Dear all,</FONT></DIV>
<DIV><FONT face=Arial size=2>Can anyone help with the following
problem...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>if c1,...,c5 were objects and I wanted to simply
count the number of missing items I can simply do</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>
<DIV><FONT face=Arial size=2>example1 <- function
()<BR>{<BR>
xx_vector(length=5))<BR> for(i in
1:5){<BR>
xx[i]_sum(is.na(eval(as.symbol(paste("c", i,
sep="")))==TRUE))<BR>
}<BR> xx<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2>This prodcues the correct results...</FONT></DIV>
<DIV><FONT face=Arial size=2>But when I merge these into a dataframe with
colnames(df)<- c("c1","c2","c3","c4","c5"), so that</FONT></DIV>
<DIV><FONT face=Arial size=2>> df<BR> c1 c2 c3 c4 c5<BR>1
1 1 NA NA NA<BR>2 2 2 NA NA NA<BR>3 3 3 NA NA
NA<BR>4 NA NA NA 1 1<BR>5 2 2 2 2
2<BR>6 2 2 2 2 2<BR>7 NA 3 3 NA
2</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>and try the next "logical" step from
above....</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>example2 <- function (x)
<BR>{<BR> xx_matrix(ncol=1,
nrow=5)<BR> for(i in
1:5){<BR>
xx[i] <- sum(is.na(eval(as.symbol(paste("x$c", i,
sep="")))==TRUE))<BR>
}<BR> xx<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2>> count.missing(x)<BR>Error in eval(expr, envir,
enclos) : Object "x$c1" not found</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any suggestions...? The counting missing data was
merely an example, I want to try and understand this process so as
to implement the idea into another function I am writing dealing with
dataframes.</FONT></DIV>
<DIV><FONT face=Arial size=2>Thanks</FONT></DIV>
<DIV><FONT face=Arial size=2>Gary.</FONT></DIV></DIV>
<DIV><FONT face=Arial
size=2>__________________________________________________<BR>Dr. Gary S.
Collins,<BR>Statistics Research Fellow,<BR>Quality of Life Unit, <BR>European
Organisation for Research and Treatment of Cancer, <BR>EORTC Data Center,
<BR>Avenue E. Mounier 83, bte. 11,<BR>B-1200 Brussels, Belgium.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Tel: +32 2 774 1 606<BR>Fax: +32 2 779 4 568<BR><A
href="http://www.eortc.be/home/qol/">http://www.eortc.be/home/qol/</A><BR>__________________________________________________</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>