Jay P. answered 06/25/19
R tutor with 10+years of R coding experience
There are multiple ways to achieve this without looping over the data.
I would use package dplyr in tidyverse and use select function, but if you want to use base R, this is my suggestion:
data[,!names(data) %in% c("iden", "name", "x_serv", "m_serv")]
Simply using this would drop out columns c("iden", "name", "x_serv", "m_serv").
Jay P.
make sure to insert comma "," when typing in : data[ , !names(data) %in% c("iden", "name", "x_serv", "m_serv")]06/25/19