Re: [R] Sum of character vector

2009-03-30 Thread David A.G
Thanks, that solved it! Date: Mon, 30 Mar 2009 09:55:17 +0200 Subject: Re: [R] Sum of character vector From: r.user.sp...@gmail.com To: dasol...@hotmail.com CC: r-help@r-project.org Hi, This: sum(data[,1]=="GG") may not work because you have some NA in your data. Try this:

Re: [R] Sum of character vector

2009-03-30 Thread Usuario R
Hi, This: sum(data[,1]=="GG") may not work because you have some NA in your data. Try this: sum( data[ , 1 ] == "GG", na.rm = TRUE ) Regards 2009/3/30 David A.G > > Dear list, > > I am trying to evaluate how many elements in a vector equal a certain > value. The vectors are the columns of a

[R] Sum of character vector

2009-03-30 Thread David A.G
Dear list, I am trying to evaluate how many elements in a vector equal a certain value. The vectors are the columns of a data.frame, read in using read.table(): > dim(data) [1] 2600 742 > data[1:5,1:5] SNP001 SNP002 SNP003 SNP004 SNP005 1 GG AA TT TT GG 2 GG AA