[R] 2 simple questions

sms13+@pitt.edu sms13+ at pitt.edu
Fri May 6 17:07:43 CEST 2005


Please excuse what I'm sure are very easy questions but I'm relatively new 
to the R environment.
How can I view a range of list elements, but not all.  e.g., I had a matrix 
of patients and then split them out by patient id.  I know I can do 
patlist[[1]] to see the first one, but how can I view, say, the first ten 
patients?

My other question is how to count how many patients have a record in which 
a certain condition holds.  E.g., I was trying something like this to get a 
count:
ctr<-0
temp<-lapply(mylist, function(x){is.na(x$date1[1]) & !is.na(x$date2[1])) 
ctr<-ctr+1})

But I don't think that's working correctly.

Thanks,
Steven




More information about the R-help mailing list