[R] list?
Marc Schwartz
marc_schwartz at comcast.net
Tue Sep 16 03:59:27 CEST 2008
on 09/15/2008 08:46 PM Paulo Cardoso wrote:
> Hi,
>
> How the data bellow was obtained? What object is tN?
>
>> tN
>
> 1 2 3 4 5 6 7 8 10 11 12
> 6 13 10 16 19 12 11 8 2 2 1
>
> str(tN)
> 'table' int [, 1:11] 6 13 10 16 19 12 11 8 2 2 ...
> - attr(*, "dimnames")=List of 1
> ..$ : chr [1:11] "1" "2" "3" "4" ...
>
> I'd like to do the same with another data.
>
> Thanks,
>
> Paulo
See ?table
N <- rep(c(1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12),
c(6, 13, 10, 16, 19, 12, 11, 8, 2, 2, 1))
> N
[1] 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3
[23] 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
[45] 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6
[67] 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 8
[89] 8 8 8 8 8 8 8 10 10 11 11 12
tN <- table(N)
> tN
N
1 2 3 4 5 6 7 8 10 11 12
6 13 10 16 19 12 11 8 2 2 1
> class(tN)
[1] "table"
> str(tN)
'table' int [, 1:11] 6 13 10 16 19 12 11 8 2 2 ...
- attr(*, "dimnames")=List of 1
..$ N: chr [1:11] "1" "2" "3" "4" ...
HTH,
Marc Schwartz
More information about the R-help
mailing list