Re: [R] Count number of rows in a matrix with a character pattern

2012-04-29 Thread Rui Barradas
Right. Michael Weylandt wrote > > I'd use a combination of rownames(), grepl() and sum(). > > Get the names with the first, test with the second and count the positives > (by coercing TRUE -> 1) with the last > > Michael > > On Apr 29, 2012, at 3:46 PM, katarv wrote: > >> Hi,

Re: [R] Count number of rows in a matrix with a character pattern

2012-04-29 Thread Rui Barradas
Hello, katarv wrote > > Hi, > > I have a large data set that I input as a matrix, where I have 1:x rows > with names AX, then x+1: y rows named AY, etc. The idea is that I have > to count how many rows exactly I have with name AX and how many I have > with name AY (or find which row numbers

Re: [R] Count number of rows in a matrix with a character pattern

2012-04-29 Thread R. Michael Weylandt
I'd use a combination of rownames(), grepl() and sum(). Get the names with the first, test with the second and count the positives (by coercing TRUE -> 1) with the last Michael On Apr 29, 2012, at 3:46 PM, katarv wrote: > Hi, > > I have a large data set that I input as a matrix, where I hav

[R] Count number of rows in a matrix with a character pattern

2012-04-29 Thread katarv
Hi, I have a large data set that I input as a matrix, where I have 1:x rows with names AX, then x+1: y rows named AY, etc. The idea is that I have to count how many rows exactly I have with name AX and how many I have with name AY (or find which row numbers have names AX). Is there any way in R