Dear all, I have a matrix with all values being log transformed. I want them back to the values before the transformation. i.e. 2^matrix M. Is there any easy code to do this? Thanks,Zhengyu [[alternative HTML version deleted]]
Hello, Just use what you've written: m <- matrix(1:12, ncol = 3) 2^m # it's a matrix Hope this helps, Rui Barradas Em 13-05-2013 19:41, JiangZhengyu escreveu:> Dear all, I have a matrix with all values being log transformed. I want them back to the values before the transformation. i.e. 2^matrix M. Is there any easy code to do this? Thanks,Zhengyu > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >
On 13-05-2013, at 20:41, JiangZhengyu <zhyjiang2006 at hotmail.com> wrote:> Dear all, I have a matrix with all values being log transformed. I want them back to the values before the transformation. i.e. 2^matrix M. Is there any easy code to do this? Thanks,ZhengyuPlease don't post in html. Have you tried 2^M assuming your log transformed matrix is M and that you used a log 2 transformation. Berend> > [[alternative HTML version deleted]] > > ______________________________________________ > 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.
Hi, ?mat1<- matrix(log(1:20),ncol=5) ?exp(mat1) #???? [,1] [,2] [,3] [,4] [,5] #[1,]??? 1??? 5??? 9?? 13?? 17 #[2,]??? 2??? 6?? 10?? 14?? 18 #[3,]??? 3??? 7?? 11?? 15?? 19 #[4,]??? 4??? 8?? 12?? 16?? 20 mat2<- matrix(log2(1:20),ncol=5) ?2^mat2 #???? [,1] [,2] [,3] [,4] [,5] #[1,]??? 1??? 5??? 9?? 13?? 17 #[2,]??? 2??? 6?? 10?? 14?? 18 #[3,]??? 3??? 7?? 11?? 15?? 19 #[4,]??? 4??? 8?? 12?? 16?? 20 A.K. ----- Original Message ----- From: JiangZhengyu <zhyjiang2006 at hotmail.com> To: "r-help at r-project.org" <r-help at r-project.org> Cc: Sent: Monday, May 13, 2013 2:41 PM Subject: [R] recover log of matrix Dear all, I have a matrix with all values being log transformed.? I want them back to the values before the transformation.? i.e. 2^matrix M. Is there any easy code to do this? Thanks,Zhengyu ??? ??? ??? ? ??? ??? ? ??? [[alternative HTML version deleted]] ______________________________________________ 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.