[R] delete a entire vector of a dataframe
David Barron
mothsailor at googlemail.com
Thu Sep 21 21:14:53 CEST 2006
There is a function remove.vars in the gdata package, or you can do this:
> > dt<-data.frame(a=(1:5),b=(6:10),c=(11:15))
> dt
a b c
1 1 6 11
2 2 7 12
3 3 8 13
4 4 9 14
5 5 10 15
> dt[["a"]] <- NULL
> dt
> dt
b c
1 6 11
2 7 12
3 8 13
4 9 14
5 10 15
If you know it is the first column that you want to remove, you can
also use dt[,-1].
On 21/09/06, Thomas Preuth <preuth at slf.ch> wrote:
> delete a entire vector of a dataframe
>
> Hello,
>
> i want to delete a vector and tried "rm (t.d$V712)". This did not work,
> message was, could not find variable. I thought the $ defines the vectro
> in a dataframe, when I just type "t.d$V712" the content of this vector
> is displayed.
>
> Greetings, Thomas
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
--
=================================
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP
More information about the R-help
mailing list