[R] Deleting a column in a dataframe by name
Henrique Dallazuanna
wwwhsd at gmail.com
Tue Sep 29 22:13:30 CEST 2009
Try this:
FRAME$NAMETODELETE <- NULL
On Tue, Sep 29, 2009 at 5:12 PM, Dennis Fisher <fisher at plessthan.com> wrote:
> 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
>
> ______________________________________________
> R-help at 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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
More information about the R-help
mailing list