Filtering Column by Multiple values [duplicate]

╄→гoц情女王★ 提交于 2021-02-16 15:41:45

问题


I would like to filter values based on one column with multiple values.

For example, one data.frame has s&p 500 tickers, i have to pick 20 of them and associated closing prices. How to do it?


回答1:


If I understand well you question, I believe you should do it with dplyr:

library(dplyr)
target <- c("Ticker1", "Ticker2", "Ticker3")
filter(df, Ticker %in% target)

The answer can be found in https://stackoverflow.com/a/25647535/9513536

Cheers !



来源:https://stackoverflow.com/questions/50687466/filtering-column-by-multiple-values

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!