Hi All,

i have a dataset that i want to dynamically inspect for the number of
variables that start with "Exposure_"  and then for these count the entries
across each case i.e

ID Exposure_1 Exposure_2 Exposure_3
1        y                 y                y
2        y                 y                -
3        y                 -                 -

So the corresponding new variables that would be created are

ID Max_Exposure Unique_Exposure
1           3                       3
2           3                       2
3           3                       1

I know this may seem fairly basic but it will give me the starting point to
develop more advanced things with loop and nat lang

Thanks in advance

Mike

        [[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