Re: [R] Rearranging Capture History Data in R

From: Benilton Carvalho <bcarvalh_at_jhsph.edu>
Date: Mon, 11 Jun 2007 16:08:59 -0400

date = c(1, 1, 1, 1, 2, 2, 3, 3, 4)
tag = c(1, 2, 3, 4, 2, 4, 1, 2, 4)
table(factor(tag, levels=1:4), factor(date, levels=1:4))

(not sure how you got Tag 1/Date 4 = 1)

On Jun 11, 2007, at 3:11 PM, cox_at_montana.edu wrote:

> What code can i use to convert a table like this:
>
> Tag# Date
> 1 1
> 2 1
> 3 1
> 4 1
> 2 2
> 4 2
> 1 3
> 2 3
> 4 4
>
> Into one like this:
>
> Tag 1 2 3 4 #Date header
> 1 1 0 0 1
> 2 1 1 1 0
> 3 1 0 0 0
> 4 1 1 0 1
>
> Thanks,
>
>
> Ben Cox
> Research Assistant (M.S.)
> Montana Cooperative Fishery Research Unit
> 301 Lewis Hall
> Montana State University
> Bozeman, MT 59717
> (406)994-6643
>
> ______________________________________________
> R-help_at_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.



R-help_at_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. Received on Mon 11 Jun 2007 - 20:45:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 11 Jun 2007 - 21:32:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.