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.
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.
Thank you, I came up with these. Problem solve. varValue <- data.frame(varLH2x, varLH2y, varHH2x, varHH2y, varLL2x, varLL2y, varHL2x, varHL2y) res<-write.xlsx(varValue, "D:\\FYP\\image\\Cropped Images\\user61\\genuineUser61temp.xlsx", sheetName="Sheet1",col.names=TRUE, row.names=TRUE, append=FALSE) -- View this message in context: http://r.789695.n4.nabble.com/write-data-using-xlsReadWrite-tp4629825p4630204.html Sent from the R help mailing list archive at Nabble.com.
Hai, I use these codes to read my data from the above data that I create, but how can I get rid of the first V1, because it is row number, not one of my data value. Second, how can I read row 1 and only column 1 (V2 value for example). setwd("D:\\FYP\\image\\Cropped Images\\user61") info <-read.xlsx("forgerUser61.xlsx",sheetName="Sheet1",rowIndex=2:2,header=FALSE)> V1 V2 V3 V4 V5 > V6 V7 V8 V9 > 1 1 1859.935 12068.61 281.5818 283.75 3330043 3495302 7557.209 > 1887.269-- View this message in context: http://r.789695.n4.nabble.com/write-data-using-xlsReadWrite-tp4629825p4630209.html Sent from the R help mailing list archive at Nabble.com.
On May 15, 2012, at 10:08 PM, diyanah wrote:> Hai, > I use these codes to read my data from the above data that I create, > but how > can I get rid of the first V1, because it is row number, not one of > my data > value.Why do you want to get rid of it? What harm is it doing? (Dataframes need to have rownames, many functions depend on that aspect of dataframes, and if you do not provide them, then default rownames get inserted.)> Second, how can I read row 1 and only column 1 (V2 value for example).Use colClasses, nrows ?read.table> > setwd("D:\\FYP\\image\\Cropped Images\\user61") > info > <- > read > .xlsx > ("forgerUser61.xlsx",sheetName="Sheet1",rowIndex=2:2,header=FALSE) > >> V1 V2 V3 V4 V5 >> V6 V7 V8 V9 >> 1 1 1859.935 12068.61 281.5818 283.75 3330043 3495302 7557.209 >> 1887.269 > > --David Winsemius, MD West Hartford, CT
Possibly Parallel Threads
- how to write data using xlsReadWrite
- Need help in waveslim package: imodwt and universal.thresh.modwt
- ??: Re: Need help in waveslim package: imodwt and universal.thresh.modwt
- struggling with pairlists
- ??: Re:??: Re: Need help in waveslim package: imodwt and universal.thresh.modwt