My data looks like this in a table (which I've called table):
column 1: (Apples A, Apples B, Bananas A, Bananas B)
column 2: (1, 2, 3, 4)
I want to create a vector of all the column 1 ending in A, and all the column 1 ending in B.
I'm using: A<-select(table, ends_with("A"))
, in an attempt to get a value of "Apples A "Apples B". Instead, I get a data frame with 4 observations and 0 variables.
I did try A<-grepl("A", fixed=TRUE, table$column1)
but that gave me true, false, true, false, which isn't what I want. I'm probably missing something stupidly obvious aren't I?