[R] Deleting Rows/Columns

Weiwei Shi helprhelp at gmail.com
Mon Nov 7 22:26:21 CET 2005


put - before the column id you want to delete.

like this:
> a<-data.frame(c(1,2,3), c(4,5,6), c(7,8,9))
> a
  c.1..2..3. c.4..5..6. c.7..8..9.
1          1          4          7
2          2          5          8
3          3          6          9
> a[,-1]
  c.4..5..6. c.7..8..9.
1          4          7
2          5          8
3          6          9

HTH

On 11/7/05, Xiaofan Li <xiaofan.mlist at gmail.com> wrote:
> Sorry to bother the group but I am wondering if there are some official ways
> to delete a row/column, i.e., some functions of dataTable manipulation? For
> rows operation I use subset() but what about columns?
>
>
>
> Any advice is welcome and I will be more than grateful if somebody could
> make a summary on this issue.
>
>
>
> Xiaofan
>
>
>
> ---------------------------------------------------------
>
> Xiaofan Li
>
> Cambridge Computational Biology Institute
>
> Department of Applied Mathematics and Theoretical Physics
>
> University of Cambridge, CB3 0WA, United Kingdom
>
> Tel +44 7886 614030, Email xl252 at cam.ac.uk
>
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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
>


--
Weiwei Shi, Ph.D

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III




More information about the R-help mailing list