[R] how to delete some columns from a matrix based on some other indicator variable
Ya-Hsiu Chuang
amichuang at hotmail.com
Wed Sep 20 22:09:05 CEST 2006
Hello,
I am not very familiar with R and need help in deleting a few columns in a
matrix.
Suppose I have a indicator variable called r and it's defined as r = (0, 0,
1, 1). A matrix D is a 3X4 matrix. If I want a new matrix which contains
only the columns of D corresponding to the elements of r that equal to 1.
how can i write a loop which creat a new matrix that contains only the last
2 columns of D in this case? thanks
More information about the R-help
mailing list