Hi,

I am an R novice and I am trying to do something that it seems should be fairly 
simple, but I can't quite figure it out and I must not be using the right words 
when I search for answers.

I have a dataset with a number of individuals and observations for each day (7 
possible codes plus missing data)
So it looks something like this 

Individual A, B, C, D
Day1 1,1,1,1
Day 2 1,3,4,2
Day3 3,,6,4
(I've also tried transposing it so that individuals are rows and days are 
columns)

I want to summarize the total observation codes by individual so that I end up 
with a table something like this:

,  1, 2 ,3 ,4, 5, 6,7, missing
A  2,0,1,0,0,0,0,0
B  1,0,1,0,0,0,0,1
C  1,0,0,1,0,1,0,0
D 1,1,0,1,0,0,0,0 

If I can get that I'll be happy! Part two is
 subsetting which days I include in the counts so that I could, say look at 
days 1-30 and 30-60 separately - create two different tables from the same 
original table. (Or I can do it manually and start with different subsets of 
the data).

Thanks so much for any help.
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to