Hello,

You can always use

df <- subset( df, select = -c(x, y, z) )

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com

Dimitri Shvorob wrote:
If I want to drop columns x, y, z from dataframe df, is there a better
alternative to

df$x = NULL
df$y = NULL
df$z = NULL

There are sufficiently many columns remaining to make
df = subset(df, select = c(a,b,c,d[etc]))

cumbersome.

Thank you.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to