我有很多类似于此的信息:
dftest_tw <- structure(list(text = c("RT @BitMEXdotcom: A new high: US$500M turnover in the last 24 hours, over 80% of it on $XBTUSD. Congrats to the team and thank you to our u…",
"RT @Crowd_indicator: Thank you for this nice video, @Nicholas_Merten",
"RT @Crow
df <-
data.frame(a=LETTERS[1:4],
b=rnorm(4)
)
vals <- c("B","D")
我可以使用以下方法过滤/子集df中的val值:
dplyr::filter(df, a %in% vals)
subset(df, a %in% vals)
两者都给予:
a b
2 B 0.4481627
4 D 0.2916513
如果我在向量中有一个变量名,例如:
> names(df)[1]
[1] "a"
那它就