[R] deleting column from data frame
Todd Ogden
to166 at columbia.edu
Tue Feb 23 17:02:01 CET 2010
There might be more elegant ways, but this will do it:
test<-test[-match("Y",names(test))]
On Feb 23, 2010, at 7:04 AM, Knut Krueger wrote:
> Hi to all,
> test <- data.frame("X"=c(1:4),"Y"=c(5:8),"Z"=c(8:11))
> test <- test[,-2]
>
> Is there a way to specify the col name "Y" to delete instead the
> number?
>
> Kind regards Knut
>
> ______________________________________________
> 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.
>
More information about the R-help
mailing list