See

?table

for details.

> tmp <- '       y    x
+ 1      1 2008
+ 2      1 2008
+ 3      0 2008
+ 4      0 2009
+ 5      1 2009'
> data <- read.table(textConnection(tmp), header=TRUE)
> data
  y    x
1 1 2008
2 1 2008
3 0 2008
4 0 2009
5 1 2009
> table(data$x, data$y)

       0 1
  2008 1 2
  2009 1 1
>

______________________________________________
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