[R] Deleting many columns of a data frame with the same name in a row

Henrique Dallazuanna wwwhsd at gmail.com
Tue Feb 2 18:04:26 CET 2010


Try this:

subset(DF, select = setdiff(names(DF), "A"))


On Tue, Feb 2, 2010 at 2:47 PM, anna <lippelanna24 at hotmail.com> wrote:
>
> This is what I just found now but I guess there is a simpler way:
>
> datas[which(names(datas)=="A")]<-list(rep(NULL,length(which(names(datas)=="A"))))
> but it worked
>
> -----
> Anna Lippel
> --
> View this message in context: http://n4.nabble.com/Deleting-many-columns-of-a-data-frame-with-the-same-name-in-a-row-tp1460078p1460091.html
> Sent from the R help mailing list archive at Nabble.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