Dear R-helpers:

I am an R novice and would appreciate answer to the following question.

Want to delete many variables in a dataframe.
Am able to delete one variable by assigning it as NULL
Have a large number of variables and would like to delete them without using
a for loop.

Is there a command/function which does this job?

Many thanks in advance.

-Sean


#Small Example:

df<-data.frame(var.a=rnorm(10), var.b=rnorm(10),var.c=rnorm(10))
df[,'var.a']<-NULL   #this works for one single variable
df[,c('var.a','var.b')]<-NULL  #does not work for multiple variables

	[[alternative HTML version deleted]]


