Skip to content
Prev 61956 / 63424 Next

Subset has No Examples for Vector Data

?s 11:00 de 10/10/2023, Dario Strbenac via R-devel escreveu:
Hello,

If you want to subset then you must refer to a variable in the original 
data set. In your example there is no 'x' in the output of table.


set.seed(2023)
random <- LETTERS[rpois(100, 10)]
(tbl <- table(random))
#> random
#>  C  D  E  F  G  H  I  J  K  L  M  N  P  Q  S
#>  1  2  4  4  8 13 14 10 17  9 11  2  1  3  1

subset(tbl, tbl > 10)
#> random
#>  H  I  K  M
#> 13 14 17 11


So it is subsetting vector data as wanted.
It is your expectation that a part of the table should be returned that 
is not in agreement with the data you have.

Hope this helps,

Rui Barradas