I have a data.frame like list.1
,I want to select the row from list.1
, which contain the value of c(101,102,103,104)
, to create a new data.frame list.2
.list.1
# ID col1 col2 col3
#1 1 101 102 201
#2 2 201 202 203
#3 3 104 NA 301
#4 4 101 NA NA
#4 5 201 301 302
The result I want is:
list.2
# ID col1 col2 col3
#1 1 101 102 201
#2 3 104 NA 301
#3 4 101 NA NA
Then the next I want is: Only contain the value of c(101,102,103,104)
from list.2
,but all put in one columnlist.3
# ID col1
#1 1 101
#2 1 102
#3 3 104
#4 4 101
Many Thanks!