[Solved] Remove selected columns in R dataframe [duplicate]


###Use subset command:###
dataframename <- subset(dataframename, select = -c(col1,col4) )

###One more approach is you can use list(NULL) to the dataframe:###
dataframename[,c("col1","col4")] <- list(NULL)

solved Remove selected columns in R dataframe [duplicate]