Hi,

I am a new user of R and am still trying to figure out which statements 
do which functions and am looking for a jump start. 

I have a dataset where the data were collected as ten minute counts 
where the number of new individuals within a species was recorded as 
cohorts within 3 separate time intervals within the ten minute count 
persiod. Each row of data therefore follows a format like this:

       Date    Time       Sample        Species t1 t2 t3
June 5,2006 5:20 AM AUSFAKE01   OVEN    3  0  1
etc.....

I would like to reformat these data as if the counts recorded only 
individuals and not cohorts, so that the above would look as follows

       Date    Time       Sample        Species t1 t2 t3
June 5,2006 5:20 AM AUSFAKE01   OVEN    1  0  0
June 5,2006 5:20 AM AUSFAKE01   OVEN    1  0  0
June 5,2006 5:20 AM AUSFAKE01   OVEN    1  0  0
June 5,2006 5:20 AM AUSFAKE01   OVEN    0  0  1
etc.....
 
I believe I could do this in SAS with IF, THEN and DO statements,

e.g. 
if t1>0 then
        do i=1 to t1
                output Date,Time,Sample,Species,"1","0","0";
if t2>0 then
        do i=1 to t2
                output Date,Time,Sample,Species,"0","1","0";
if t3>0 then
        do i=1 to t3
                output Date,Time,Sample,Species,"0","0","1";
end;


Can anyone point me in the right direction? What is the similar 
statement to DO in R?

Steve VW

______________________________________________
R-help@stat.math.ethz.ch 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