[R] write data using xlsReadWrite

Ethan Brown ethancbrown at gmail.com
Mon May 14 23:23:53 CEST 2012


You're trying to write an object that you've never created. If you
want to write `varHL2y`, which it appears you do, you would replace
that for `mydata` in your command.

Best,
Ethan


On Sun, May 13, 2012 at 1:33 AM, diyanah <yanadj28 at gmail.com> wrote:
> Hai, I'm trying to write these var output data from these codes inside excel
> file. My directory to store the data is
> /D:\FYP\image /
> but receive an error message :
>
> /Error in write.xls(mydata, "D:\\FYP\\image.mydata.xls") :
>  object 'mydata' not found/
>
> these are my codes, can you help give an advice or idea with my problem:
>
> /library("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")/
>
> --
> View this message in context: http://r.789695.n4.nabble.com/write-data-using-xlsReadWrite-tp4629825.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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