[R] how to delete a matrix column

Angel - angel_lul at hotmail.com
Tue Mar 2 19:34:48 CET 2004


Shouldn't this be in the "An introduction to R", It is explained for a 
vector but I couldn't find it for matrix.

A<-matrix(1:25,5,5)
A<-A[,-2] # delete column 2
A<-A[,-c(1,4)] #delete columns 1 and 4


Angel


Aimin Yan wrote:

>Hello,
>I am new to R, How to delete a matrix column.
>Thanks,
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! 
>http://www.R-project.org/posting-guide.html
>
>.
>




More information about the R-help mailing list