Skip to content
Prev 69275 / 398528 Next

how to get such a subset of a matrix?

one way to do it is:

mat <- matrix(rnorm(20*20), 20, 20)
mat[sample(400, 40)] <- NA
#####
mat
mat[rowSums(is.na(mat)) <= 2, ]


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Xiao Shi" <bioconductor.cn at gmail.com>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, May 06, 2005 3:21 PM
Subject: [R] how to get such a subset of a matrix?