Null-Hypothesis Null-Hypothesis - 10 months ago 42
R Question

R data frame remove column using grep - columns don't get remove

I have following loop: <- c('C_', 'WWTest_', 'TotalClick', 'IPA_', 'Sell', 'G_')
for (i in length( {

final.frame <- final.frame[, -grep([i], colnames(final.frame))]

But when i look at the data frame by trying to do
its still shows up as all.

for (i in {
    final.frame <- final.frame[!grepl(i, colnames(final.frame))]

Edit: Doing this without a loop <- paste(, collapse = '|')
final.frame <- final.frame[!grepl(, colnames(final.frame))]