0

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?

moodymudskipper
  • 46,417
  • 11
  • 121
  • 167
Pranesh Murthy
  • 1
  • 1
  • 1
  • 2

1 Answers1

3

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 !

Carles
  • 2,731
  • 14
  • 25