Megan C. answered 08/09/19
Biostatistician, M.S.
This can be done simply in base R using the column number (2), or the column name ('genome'):
data[,-2] # This takes the dataset, 'data', keeps all rows (i.e., nothing before the comma),
# and removes the second column
data[,-c('genome')] # Similarly, this takes the dataset, 'data', keeps all rows (i.e., nothing before the
# comma), and removes the column named 'genome'
Similary, using dyplr, you can use the select() function. This function selects specified variables from a data frame. To remove a variable, you simply put a minus sign in front of it.
data %>% select(-genome)