HI, Not sure how your dataset looks like: If it is like this:
set.seed(18) mat1<-matrix(sample(LETTERS[1:3],54,replace=TRUE),ncol=3) mat1[apply(mat1,1,function(x) all(x=="A")),] #[1] "A" "A" "A" which(apply(mat1,1,function(x) all(x=="A")) ) #[1] 16 A.K. ----- Original Message ----- From: Peter Kupfer <peter.kup...@me.com> To: "r-help@r-project.org" <r-help@r-project.org> Cc: Sent: Friday, November 16, 2012 9:04 AM Subject: [R] Deleting rows with special character Dear all, maybe a simple problem but I found no solution for my problem. I have a matrix Y with 23 000 rows and 220 colums. The entries are "A", "B" or "C". I want to extract all rows (as a matrix ) of the matrix Y where all entries of a row are (for example) "A". Is there any solution? I tried the stringr- package but i doesn't work out. All the best and thanks! Peter ______________________________________________ R-help@r-project.org 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. ______________________________________________ R-help@r-project.org 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.