I have a meta data frame and a counts data frame. The counts data frame has samples IDs as column headers and has 477 columns. The meta data frame has the first column called samples that has sample IDs as its values in the rows. It has 465 values or rows. I am trying to keep only the samples in the counts file that occur in the samples column of the meta data frame. I have tried this command:
counts=counts[,meta$sample]
however, I get this error
Error in [.data.frame(counts, , meta$sample) : undefined columns selected Calls: [ -> [.data.frame
I need help on why I am getting that error when I use that command. I know this works because it worked previously on another data frame and even on a dummy data frame set that I created. So if someone could help explain why this command is not working. Do not require another solution to this just why this command is giving me that error. Appreciate the help

