[R] how to write data using xlsReadWrite

David L Carlson dcarlson at tamu.edu
Mon May 14 18:15:34 CEST 2012


You didn't tell us what your problem is, but it probably relates to the fact
that mydata is never defined.

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Nurdiyanah Jambari
> Sent: Sunday, May 13, 2012 12:04 AM
> To: r-help at r-project.org
> Subject: [R] how to write data using xlsReadWrite
> 
> Hai I'm Dee. I'm trying to write var data from these codes inside excel
> file. My directory to store the data is *D:\FYP\image* .
> these are my codes, can you help give an advice or idea with my
> problem:
> 
> l*ibrary("biOps")
> library("waveslim")
> library("xlsReadWrite")
> 
> x <- readTiff("D:\\FYP\\image\\SignatureImage\\user186g1.tif")
> y <- imgBlockMedianFilter(x, 5)
> #Plot image
> #plot(y)
> 
> y.modwt <- modwt.2d(y, "la8", 2)
> ## Level 2 decomposition
> par(mfrow=c(2,2), pty="s")
> 
> ##Plot wavelets
> image(y.modwt$LH2, col=rainbow(128), axes=FALSE, main="LH2")
> image(y.modwt$HH2, col=rainbow(128), axes=FALSE, main="HH2")
> image(y.modwt$LL2, col=rainbow(128), axes=FALSE, main="LL2")
> image(y.modwt$HL2, col=rainbow(128), axes=FALSE, main="HL2")
> 
> #-------------------------------------------------------------------#
> ##Get the dimension
> ##LH2
> dimLH2 <- dim(y.modwt$LH2)
> dimLH2x <- dimLH2[1]
> dimLH2y <- dimLH2[2]
> varLH2xlist <- c(rep(0, dimLH2x))
> varLH2ylist <- c(rep(0, dimLH2y))
> 
> 
> ##Loop to get variance from x axis
> for(i in seq(dimLH2x)){
>     varLH2xlist[i] <- var(y.modwt$LH2[i,])
> }
> 
> ##Get the variance from the overall x variance
> varLH2x <- var(varLH2xlist)
> 
> ##Loop to get variance from y axis
> for(i in seq(dimLH2y)){
>     varLH2ylist[i] <- var(y.modwt$LH2[,i])
> }
> 
> ##Get the variance from the overall y variance
> varLH2y <- var(varLH2ylist)
> 
> #-----------------------------------------------------------------#
> ##Get the dimension
> ##HH2
> dimHH2 <- dim(y.modwt$HH2)
> dimHH2x <- dimHH2[1]
> dimHH2y <- dimHH2[2]
> varHH2xlist <- c(rep(0, dimHH2x))
> varHH2ylist <- c(rep(0, dimHH2y))
> 
> 
> ##Loop to get variance from x axis
> for(i in seq(dimHH2x)){
>     varHH2xlist[i] <- var(y.modwt$HH2[i,])
> }
> 
> ##Get the variance from the overall x variance
> varHH2x <- var(varHH2xlist)
> 
> ##Loop to get variance from y axis
> for(i in seq(dimHH2y)){
>     varHH2ylist[i] <- var(y.modwt$HH2[,i])
> }
> 
> ##Get the variance from the overall y variance
> varHH2y <- var(varHH2ylist)
> 
> #-----------------------------------------------------------------#
> ##Get the dimension
> ##LL2
> dimLL2 <- dim(y.modwt$LL2)
> dimLL2x <- dimLL2[1]
> dimLL2y <- dimLL2[2]
> varLL2xlist <- c(rep(0, dimLL2x))
> varLL2ylist <- c(rep(0, dimLL2y))
> 
> 
> ##Loop to get variance from x axis
> for(i in seq(dimLL2x)){
>     varLL2xlist[i] <- var(y.modwt$LL2[i,])
> }
> 
> ##Get the variance from the overall x variance
> varLL2x <- var(varLL2xlist)
> 
> ##Loop to get variance from y axis
> for(i in seq(dimLL2y)){
>     varLL2ylist[i] <- var(y.modwt$LL2[,i])
> }
> 
> ##Get the variance from the overall y variance
> varLL2y <- var(varLL2ylist)
> 
> #-----------------------------------------------------------------#
> ##Get the dimension
> ##HL2
> dimHL2 <- dim(y.modwt$HL2)
> dimHL2x <- dimHL2[1]
> dimHL2y <- dimHL2[2]
> varHL2xlist <- c(rep(0, dimHL2x))
> varHL2ylist <- c(rep(0, dimHL2y))
> 
> 
> ##Loop to get variance from x axis
> for(i in seq(dimHL2x)){
>     varHL2xlist[i] <- var(y.modwt$HL2[i,])
> }
> 
> ##Get the variance from the overall x variance
> varHL2x <- var(varHL2xlist)
> 
> ##Loop to get variance from y axis
> for(i in seq(dimHL2y)){
>     varHL2ylist[i] <- var(y.modwt$HL2[,i])
> }
> 
> ##Get the variance from the overall y variance
> varHL2y <- var(varHL2ylist)
> 
> #-----------------------------------------------------------------#
> ##write excel file
> 
> write.xls(mydata, "D:\\FYP\\image.mydata.xls")*
> 
> --
> Nurdiyanah Bt Hj Jambari
> Student
> Faculty of Engineering
> Bachelor Engineering of Computer & Communication System Engineering
> University Putra Malaysia
> 
> 	[[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.



More information about the R-help mailing list