I'm using the R table() function, it only gives me 4222 rows, is there some kind of configuration to accept more rows?
+2
A:
table
function is not limited to 4222 rows. Most likely, it is the printing limit that gives you the trouble.
Try:
options(max.print = 20000)
also, check the "real" number of rows:
tbl <- table(state.division, state.region)
nrow(tbl)
VitoshKa
2010-10-31 09:20:03
A:
Nothing wrong with larger tables? What gave you that impression?
> set.seed(123)
> fac <- factor(sample(10000, 10000, rep = TRUE))
> fac2 <- factor(sample(10000, 10000, rep = TRUE))
> tab <- table(fac, fac2)
> str(tab)
'table' int [1:6282, 1:6279] 0 0 0 0 0 0 0 0 0 0 ...
- attr(*, "dimnames")=List of 2
..$ fac : chr [1:6282] "1" "5" "7" "9" ...
..$ fac2: chr [1:6279] "1" "2" "3" "4" ...
Printing tab
will cause problems - it takes a while to generate and then you'll get this message:
[ reached getOption("max.print") -- omitted 6267 rows ]]
You can alter that by changing options(max.print = XXXXX)
where XXXXX
is some large number. But I don't see what is gained by printing such a large table? If you were trying to do this to see if the correct table had been produced, size-wise, then
> dim(tab)
[1] 6282 6279
> str(tab)
'table' int [1:6282, 1:6279] 0 0 0 0 0 0 0 0 0 0 ...
- attr(*, "dimnames")=List of 2
..$ fac : chr [1:6282] "1" "5" "7" "9" ...
..$ fac2: chr [1:6279] "1" "2" "3" "4" ...
help with that.
Gavin Simpson
2010-10-31 09:25:14