knn.imput and prcomp error
1
0
Entering edit mode
@ingrid-hgstensen-1885
Last seen 9.6 years ago
Hi I am running a microarray analysis that I have run before (on the same data set) but now I get an error message because my matrix suddenly is no longer numeric. Does anybody know what happens and how do solve it? Below I have pasted the commands and error message. Ingrid memory.limit(1300) library(limma) library(impute) aneTab <- read.table(file="S100A4_anes.txt",sep="\t",header=T,na.strings="") colnames(aneTab) aneData <- aneTab[,3:14] aneData <- as.matrix(aneData) is.matrix(aneData) aneData_imp <- impute.knn(aneData) aneDI_prc <-prcomp(t(aneData_imp)) Error in colMeans(x, n, prod(dn), na.rm) : 'x' must be numeric -- Ingrid H.G. ?stensen Bioinformatics user support (NMC) Department of Tumour Biology The Norwegian Radiumhospital 0310 Oslo E -mail: ingrid at microarray.no Phone: +47 22 93 54 11 Fax: +47 22 52 24 21
Microarray impute Microarray impute • 1.7k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 4 hours ago
United States
Ingrid H.G. ?stensen wrote: > Hi > > I am running a microarray analysis that I have run before (on the same > data set) but now I get an error message because my matrix suddenly is no > longer numeric. Does anybody know what happens and how do solve it? Below > I have pasted the commands and error message. > > Ingrid > > memory.limit(1300) > library(limma) > library(impute) > aneTab <- read.table(file="S100A4_anes.txt",sep="\t",header=T,na.strings="") > colnames(aneTab) > aneData <- aneTab[,3:14] Are all the values in andData numeric? What do you get from str(aneData)? If the values are not all numeric, when you coerce to a matrix everything will be coerced to some common type (often character). For instance, if there are factors and numeric values in your data.frame, they will all get coerced to character, which may be what is happening. HTH, Jim > aneData <- as.matrix(aneData) > is.matrix(aneData) > aneData_imp <- impute.knn(aneData) > aneDI_prc <-prcomp(t(aneData_imp)) > Error in colMeans(x, n, prod(dn), na.rm) : > 'x' must be numeric > > > -- James W. MacDonald, M.S. Biostatistician Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.
ADD COMMENT
0
Entering edit mode
Hi, aneData is numeric but aneData_imp is not. But I have been told that because of the changes in knn.impute I now have to use aneData_imput$data instead of aneData_imp. I have tried this and now I do not get an error message any more. Regards, Ingrid > Ingrid H.G. ??stensen wrote: >> Hi >> >> I am running a microarray analysis that I have run before (on the same >> data set) but now I get an error message because my matrix suddenly is >> no >> longer numeric. Does anybody know what happens and how do solve it? >> Below >> I have pasted the commands and error message. >> >> Ingrid >> >> memory.limit(1300) >> library(limma) >> library(impute) >> aneTab <- >> read.table(file="S100A4_anes.txt",sep="\t",header=T,na.strings="") >> colnames(aneTab) >> aneData <- aneTab[,3:14] > > Are all the values in andData numeric? What do you get from str(aneData)? > > If the values are not all numeric, when you coerce to a matrix > everything will be coerced to some common type (often character). For > instance, if there are factors and numeric values in your data.frame, > they will all get coerced to character, which may be what is happening. > > HTH, > > Jim > > >> aneData <- as.matrix(aneData) >> is.matrix(aneData) >> aneData_imp <- impute.knn(aneData) >> aneDI_prc <-prcomp(t(aneData_imp)) >> Error in colMeans(x, n, prod(dn), na.rm) : >> 'x' must be numeric >> >> >> > > > -- > James W. MacDonald, M.S. > Biostatistician > Affymetrix and cDNA Microarray Core > University of Michigan Cancer Center > 1500 E. Medical Center Drive > 7410 CCGC > Ann Arbor MI 48109 > 734-647-5623 > > > ********************************************************** > Electronic Mail is not secure, may not be read every day, and should not > be used for urgent or sensitive issues. > -- Ingrid H.G. ?stensen Bioinformatics user support (NMC) Department of Tumour Biology The Norwegian Radiumhospital 0310 Oslo E -mail: ingrid at microarray.no Phone: +47 22 93 54 11 Fax: +47 22 52 24 21
ADD REPLY

Login before adding your answer.

Traffic: 567 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