A list, a matrix and impute.knn for making data for SAMR
1
0
Entering edit mode
John Herbert ▴ 90
@john-herbert-3373
Last seen 10.2 years ago
Dear Bioconductors, Please can you help me with small annoying problem. I want to impute a matrix that has 4 columns of data. Using the impute.knn package returns me a list not a matrix. Using as.matrix to return the data returned from impute.knn does not give me the same matrix structure as I began with? It must be a simple answer? My code: library(impute); imputed_data <- impute.knn(normalised_data, k=5); > dim(normalised_data) [1] 43376 4 > dim(imputed_data) NULL > class(normalised_data) [1] "matrix" > class(imputed_data) [1] "list" Why does impute.knn not return the data as you would sensibly think it would, ie in the same format as your microarray data? Please tell me if I am missing something or the solution? Thanks a lot for any help. Kind regards, John. [[alternative HTML version deleted]]
Microarray impute Microarray impute • 1.6k views
ADD COMMENT
0
Entering edit mode
@elin-axelsson-2940
Last seen 10.2 years ago
Hi John, if you look in ?impute.knn under the "value" section you will see that function returns 3 things; the data matrix, the rng.seed and the rng.state. It's returned as list, as you noticed, if you want the data matrix you simply write imputed_data$data. Hope this helps, Elin John Herbert wrote: > Dear Bioconductors, > > Please can you help me with small annoying problem. > > > > I want to impute a matrix that has 4 columns of data. Using the > impute.knn package returns me a list not a matrix. > > > > Using as.matrix to return the data returned from impute.knn does not > give me the same matrix structure as I began with? > > It must be a simple answer? > > > > My code: > > > > library(impute); > > imputed_data <- impute.knn(normalised_data, k=5); > > > > >> dim(normalised_data) >> > > [1] 43376 4 > > >> dim(imputed_data) >> > > NULL > > >> class(normalised_data) >> > > [1] "matrix" > > >> class(imputed_data) >> > > [1] "list" > > > > Why does impute.knn not return the data as you would sensibly think it > would, ie in the same format as your microarray data? > > Please tell me if I am missing something or the solution? > > > > Thanks a lot for any help. > > > > Kind regards, > > > > John. > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor >
ADD COMMENT
0
Entering edit mode
Hello Elin. Thanks very much for solving my problem, it helps a lot. I knew it would be simple, just like me :-). Actually, that is very useful advice as I was wondering if it told you somewhere what it returned. I should read more thoroughly before posting, sorry. Kind regards, John. -----Original Message----- From: Elin Axelsson [mailto:elin@ebi.ac.uk] Sent: 11 August 2009 13:06 To: John Herbert Cc: bioconductor at stat.math.ethz.ch Subject: Re: [BioC] A list, a matrix and impute.knn for making data for SAMR Hi John, if you look in ?impute.knn under the "value" section you will see that function returns 3 things; the data matrix, the rng.seed and the rng.state. It's returned as list, as you noticed, if you want the data matrix you simply write imputed_data$data. Hope this helps, Elin John Herbert wrote: > Dear Bioconductors, > > Please can you help me with small annoying problem. > > > > I want to impute a matrix that has 4 columns of data. Using the > impute.knn package returns me a list not a matrix. > > > > Using as.matrix to return the data returned from impute.knn does not > give me the same matrix structure as I began with? > > It must be a simple answer? > > > > My code: > > > > library(impute); > > imputed_data <- impute.knn(normalised_data, k=5); > > > > >> dim(normalised_data) >> > > [1] 43376 4 > > >> dim(imputed_data) >> > > NULL > > >> class(normalised_data) >> > > [1] "matrix" > > >> class(imputed_data) >> > > [1] "list" > > > > Why does impute.knn not return the data as you would sensibly think it > would, ie in the same format as your microarray data? > > Please tell me if I am missing something or the solution? > > > > Thanks a lot for any help. > > > > Kind regards, > > > > John. > > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor >
ADD REPLY

Login before adding your answer.

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