[R] Deleting a column in a dataframe by name

Dennis Fisher fisher at plessthan.com
Tue Sep 29 22:12:08 CEST 2009


Colleagues,

Hopefully a simple problem: I want to delete a column with a known  
name from a dataframe.  I could write:

	FRAME	<- FRAME[, names(FRAME) != NAMETODELETE]
or
	FRAME	<- FRAME[, !names(FRAME) %in% c(NAME1, NAME2, ETC)]

Is there some simpler means to accomplish this?

Dennis


Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com




More information about the R-help mailing list