Seyma Kalay
Seyma Kalay

Reputation: 2859

Select all the values from table in R

I have table(hh_release_eng_20130109$b3009) and the result is

 1    2   3   4 
 76   7  56 160 

I want to select all the values from that table

select.all <- hh_release_eng_20130109 %>%
filter( hh_release_eng_20130109$b3009==1 &  hh_release_eng_20130109$b3009==2 &
        hh_release_eng_20130109$b3009==3 &  hh_release_eng_20130109$b3009==4 )

is there any shortcut for this? many thanks in advance,

Upvotes: 0

Views: 120

Answers (1)

DJV
DJV

Reputation: 4863

Not sure if that's what your looking for (I'm using mtcars as sample data):

mtcars[mtcars$carb %in% as.numeric(as.data.frame(table(mtcars$carb))$Var1),]

Upvotes: 1

Related Questions