I have a data frame with about 40 columns, the second column, data[2] contains the name of the company that the rest of the row data describes. However, the names of the companies are different depending on the year (trailing 09 for 2009 data, nothing for 2010).
I would like to be able to subset the data such that I can pull in both years at once. Here is an example of what I'm trying to do...
subset(data, data[2] == "Company Name 09" | "Company Name", drop = T)
Essentially, I'm having difficulty using the OR operator within the subset function.
However, I have tried other alternatives:
subset(data, data[[2]] == grep("Company Name", data[[2]]))
Perhaps there's an easier way to do it using a string function?
Any thoughts would be appreicated.