How to drop a variable in R?

r

#1

I am currently working on data set in which I have created an additional variable name as a year .

str(mtcars)
mtcars$year <- 1974

I want to know If I want to delete this variable from the data set how I can perform this on R.


#2

set the variable to NULL to drop it
mtcars$year <- NULL