Re: [R] Problem with rowMeans()

From: Wacek Kusnierczyk <Waclaw.Marcin.Kusnierczyk_at_idi.ntnu.no>
Date: Fri, 13 Jun 2008 01:01:00 +0200

ss wrote:
> Thank you very much, Wacek! It works very well.
> But there is a minor problem. I did the following:
>
> >data <-
> read.table('E-TABM-1-processed-data-1342561271_log2_with_symbols.txt',
> +row.names = NULL ,header=TRUE, fill=TRUE)

looks like you have a data frame, not a matrix

> > dim(data)
> [1] 23963 85
> > data[1:4,1:4]
> Probe_ID Gene_Symbol M16012391010920 M16012391010525
> 1 A_23_P105862 13CDNA73 -1.6 0.16
> 2 A_23_P76435 15E1.2 0.18 0.59
> 3 A_24_P402115 15E1.2 1.63 -0.62
> 4 A_32_P227764 15E1.2 -0.76 -0.42
> >data1<-data[sapply(data, is.numeric)]
> > dim(data1)
> [1] 23963 82
> > data1[1:4,1:4]
> M16012391010525 M16012391010843 M16012391010531 M16012391010921
> 1 0.16 -0.23 -1.40 0.90
> 2 0.59 0.28 -0.30 0.08
> 3 -0.62 -0.62 -0.22 -0.18
> 4 -0.42 0.01 0.28 -0.79
>
> You will notice that, after using 'data[sapply(data, is.numeric)]' and
> getting
> data1, the first sample in data, called 'M16012391010920', was missed
> in data1.
>
> Any further suggestions?
>

surely there must be an entry in column 3 that makes it non-numeric. what does is.numeric(data[3]) say? (NAs should not make a column non-numeric, unless there are only NAs there, which is not the case here.) check your data for non-numeric entries in column 3, there can be a typo.

vQ



R-help_at_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. Received on Thu 12 Jun 2008 - 23:06:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 13 Jun 2008 - 01:31:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive