LIMMA: Error in rowMeans(y$exprs, na.rm=TRUE):'x' must be numeric
1
0
Entering edit mode
Kripa R ▴ 180
@kripa-r-4482
Last seen 10.2 years ago
Hi so I'm trying to do limma fitting on my data but i keep getting the following error Error in rowMeans(y$exprs, na.rm=TRUE):'x' must be numeric But I'm not sure what the problem is does anyone have suggestions? Here's what i've been doing after normalization: data<-subset(data_pheno, select=is.na(data_pheno['case',])==FALSE) #remove columns with NA group <- factor(data['case',]) design <- model.matrix(~0+group) #dim 240 2 expr<-as.data.frame(data[1:39693,]) #only keep rows that need to fit aka expression data, dim 39693 240 fit <- lmFit(expr,design) Error in rowMeans(y$exprs, na.rm=TRUE):'x' must be numeric Thanks, .kripa [[alternative HTML version deleted]]
limma limma • 10k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 30 minutes ago
United States
Hi Kripa, On 10/4/2012 12:54 PM, Kripa R wrote: > Hi so I'm trying to do limma fitting on my data but i keep getting the following error > Error in rowMeans(y$exprs, na.rm=TRUE):'x' must be numeric > But I'm not sure what the problem is does anyone have suggestions? > > Here's what i've been doing after normalization: > data<-subset(data_pheno, select=is.na(data_pheno['case',])==FALSE) #remove columns with NA > group<- factor(data['case',]) > design<- model.matrix(~0+group) #dim 240 2 > expr<-as.data.frame(data[1:39693,]) #only keep rows that need to fit aka expression data, dim 39693 240 > > fit<- lmFit(expr,design) > Error in rowMeans(y$exprs, na.rm=TRUE):'x' must be numeric The help page for lmFit() lists lots of possible input object types, but data.frame is not one of them. Your code is fairly cryptic, so I have no idea what is in that data.frame, other than the obvious conclusion that there are some non-numeric data. You would be better served to use existing infrastructure for processing your data rather than a data.frame. I think there should be enough examples in the limma User's Guide to show you the way. Best, Jim > > > Thanks, > .kripa > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician University of Washington Environmental and Occupational Health Sciences 4225 Roosevelt Way NE, # 100 Seattle WA 98105-6099
ADD COMMENT
0
Entering edit mode
Hi, changing the data to a matrix doesn't help. I think it has something to do with my design matrix which has NAs design <- model.matrix(~0+group, model.frame(~0+group,data, na.action=NULL)) > design[55:65,] group1 group2 55 0 1 56 1 0 57 1 0 58 0 1 59 1 0 60 0 1 61 NA NA 62 1 0 63 0 1 64 0 1 65 1 0 So right now dim(design): 247 2 and dim(data) 39000 247 But doing the next two lines results in the same error data<-as.matrix(data) fit <- lmFit(data,design) Error in qr.default(x) : NA/NaN/Inf in foreign function call (arg 1) How could I tell lmFit that when it reaches an NA in the design it should just ignore the data in the corresponding data column? Thanks, .kripa > Date: Thu, 4 Oct 2012 13:05:33 -0400 > From: jmacdon@uw.edu > To: kripa777@hotmail.com > CC: bioconductor@r-project.org > Subject: Re: [BioC] LIMMA: Error in rowMeans(y$exprs, na.rm=TRUE):'x' must be numeric > > Hi Kripa, > > On 10/4/2012 12:54 PM, Kripa R wrote: > > Hi so I'm trying to do limma fitting on my data but i keep getting the following error > > Error in rowMeans(y$exprs, na.rm=TRUE):'x' must be numeric > > But I'm not sure what the problem is does anyone have suggestions? > > > > Here's what i've been doing after normalization: > > data<-subset(data_pheno, select=is.na(data_pheno['case',])==FALSE) #remove columns with NA > > group<- factor(data['case',]) > > design<- model.matrix(~0+group) #dim 240 2 > > expr<-as.data.frame(data[1:39693,]) #only keep rows that need to fit aka expression data, dim 39693 240 > > > > fit<- lmFit(expr,design) > > Error in rowMeans(y$exprs, na.rm=TRUE):'x' must be numeric > > The help page for lmFit() lists lots of possible input object types, but > data.frame is not one of them. Your code is fairly cryptic, so I have no > idea what is in that data.frame, other than the obvious conclusion that > there are some non-numeric data. > > You would be better served to use existing infrastructure for processing > your data rather than a data.frame. I think there should be enough > examples in the limma User's Guide to show you the way. > > > Best, > > Jim > > > > > > > > Thanks, > > .kripa > > [[alternative HTML version deleted]] > > > > _______________________________________________ > > Bioconductor mailing list > > Bioconductor@r-project.org > > https://stat.ethz.ch/mailman/listinfo/bioconductor > > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > > -- > James W. MacDonald, M.S. > Biostatistician > University of Washington > Environmental and Occupational Health Sciences > 4225 Roosevelt Way NE, # 100 > Seattle WA 98105-6099 > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
Hi Kripa, On 10/11/2012 1:37 PM, Kripa R wrote: > Hi, changing the data to a matrix doesn't help. I think it has > something to do with my design matrix which has NAs > > design <- model.matrix(~0+group, model.frame(~0+group,data, > na.action=NULL)) > > design[55:65,] > group1 group2 > 55 0 1 > 56 1 0 > 57 1 0 > 58 0 1 > 59 1 0 > 60 0 1 > 61 NA NA > 62 1 0 > 63 0 1 > 64 0 1 > 65 1 0 > So right now dim(design): 247 2 and dim(data) 39000 247 > But doing the next two lines results in the same error > data<-as.matrix(data) > fit <- lmFit(data,design) > /Error in qr.default(x) : NA/NaN/Inf in foreign function call (arg 1)/ > > How could I tell lmFit that when it reaches an NA in the design it > should just ignore the data in the corresponding data column? You don't. If you don't want to fit a model to all of your data, just subset to the data you are interested in and go from there. Best, Jim > > Thanks, > > .kripa > > > Date: Thu, 4 Oct 2012 13:05:33 -0400 > > From: jmacdon at uw.edu > > To: kripa777 at hotmail.com > > CC: bioconductor at r-project.org > > Subject: Re: [BioC] LIMMA: Error in rowMeans(y$exprs, > na.rm=TRUE):'x' must be numeric > > > > Hi Kripa, > > > > On 10/4/2012 12:54 PM, Kripa R wrote: > > > Hi so I'm trying to do limma fitting on my data but i keep getting > the following error > > > Error in rowMeans(y$exprs, na.rm=TRUE):'x' must be numeric > > > But I'm not sure what the problem is does anyone have suggestions? > > > > > > Here's what i've been doing after normalization: > > > data<-subset(data_pheno, select=is.na(data_pheno['case',])==FALSE) > #remove columns with NA > > > group<- factor(data['case',]) > > > design<- model.matrix(~0+group) #dim 240 2 > > > expr<-as.data.frame(data[1:39693,]) #only keep rows that need to > fit aka expression data, dim 39693 240 > > > > > > fit<- lmFit(expr,design) > > > Error in rowMeans(y$exprs, na.rm=TRUE):'x' must be numeric > > > > The help page for lmFit() lists lots of possible input object types, > but > > data.frame is not one of them. Your code is fairly cryptic, so I > have no > > idea what is in that data.frame, other than the obvious conclusion that > > there are some non-numeric data. > > > > You would be better served to use existing infrastructure for > processing > > your data rather than a data.frame. I think there should be enough > > examples in the limma User's Guide to show you the way. > > > > > > Best, > > > > Jim > > > > > > > > > > > > > Thanks, > > > .kripa > > > [[alternative HTML version deleted]] > > > > > > _______________________________________________ > > > Bioconductor mailing list > > > Bioconductor at r-project.org > > > https://stat.ethz.ch/mailman/listinfo/bioconductor > > > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > > > > -- > > James W. MacDonald, M.S. > > Biostatistician > > University of Washington > > Environmental and Occupational Health Sciences > > 4225 Roosevelt Way NE, # 100 > > Seattle WA 98105-6099 > > -- James W. MacDonald, M.S. Biostatistician University of Washington Environmental and Occupational Health Sciences 4225 Roosevelt Way NE, # 100 Seattle WA 98105-6099
ADD REPLY

Login before adding your answer.

Traffic: 913 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6