mauede at alice.it
2009-Mar-04 05:36 UTC
[R] flaw in CRAN package "wavelets": Daubechies "d8" not recognized by function wt.filter
> wt.filter("d8") #### HOW COME ????Error in validObject(.Object) : invalid class "wt.filter" object: invalid object for slot "transform" in class "wt.filter": got class "function", should be or extend class "character"> wt.filter("d10") # OKAn object of class “wt.filter” Slot "L": [1] 10> wt.filter("d6") #OKAn object of class “wt.filter” Slot "L": [1] 6 Thank you in advance to anyone who takes care of reported bugs in CRAN packages. Maura tutti i telefonini TIM! [[alternative HTML version deleted]]
David Winsemius
2009-Mar-04 06:20 UTC
[R] flaw in CRAN package "wavelets": Daubechies "d8" not recognized by function wt.filter
You can look at the code yourself. The d8 filter appears to have a deletion mutation making it "different" than the other d-series and the fix looks feasible for testing: d6.filter <- function(mod = F) { class <- "Daubechies" name <- "d6" L <- as.integer(6) g <- c(0.332670552950083, 0.806891509311093, 0.459877502118491, -0.135011020010255, -0.0854412738820267, 0.0352262918857096) if (modwt == TRUE) { g <- g/sqrt(2) transform <- "modwt" } else transform <- "dwt" h <- wt.filter.qmf(g, inverse = TRUE) wt.filter <- new("wt.filter", L = L, h = h, g = g, wt.class = class, wt.name = name, transform = transform) return(wt.filter) } d8.filter <- function(mod = F) { class <- "Daubechies" name <- "d8" L <- as.integer(8) g <- c(0.230377813307443, 0.714846570548406, 0.630880767935879, -0.0279837694166834, -0.187034811717913, 0.0308413818353661, 0.0328830116666778, -0.0105974017850021) < missing code> h <- wt.filter.qmf(g, inverse = TRUE) wt.filter <- new("wt.filter", L = L, h = h, g = g, wt.class = class, wt.name = name, transform = transform) return(wt.filter) } d10.filter <- function(mod = F) { class <- "Daubechies" name <- "d10" L <- as.integer(10) g <- c(0.160102397974193, 0.60382926979719, 0.724308528437773, 0.138428145901320, -0.242294887066382, -0.0322448695846381, 0.0775714938400459, -0.0062414902127983, -0.012580751999082, 0.0033357252854738) if (modwt == TRUE) { g <- g/sqrt(2) transform <- "modwt" } else transform <- "dwt" h <- wt.filter.qmf(g, inverse = TRUE) wt.filter <- new("wt.filter", L = L, h = h, g = g, wt.class = class, wt.name = name, transform = transform) return(wt.filter) } Make your own wt.filter with the missing code inserted and see if happiness prevails.When I apply the fix, I get: > wt.filter("d8") An object of class ?wt.filter? Slot "L": [1] 8 Slot "level": [1] 1 Slot "h": [1] -0.01059740 -0.03288301 0.03084138 0.18703481 -0.02798377 -0.63088077 0.71484657 -0.23037781 Slot "g": [1] 0.23037781 0.71484657 0.63088077 -0.02798377 -0.18703481 0.03084138 0.03288301 -0.01059740 Slot "wt.class": [1] "Daubechies" Slot "wt.name": [1] "d8" Slot "transform": [1] "dwt" By the way, there also appears to be no d2 and calling wt.filter with "d2" also provokes an error. The proper manner for getting this addressed is to draw it to the attention of the package maintainer rather than posting a "to whom it may concern" message to the list. -- David Winsemius On Mar 4, 2009, at 12:36 AM, <mauede at alice.it> <mauede at alice.it> wrote:>> wt.filter("d8") #### HOW COME ???? > Error in validObject(.Object) : > invalid class "wt.filter" object: invalid object for slot > "transform" in class "wt.filter": got class "function", should be or > extend class "character" > >> wt.filter("d10") # OK > An object of class ?wt.filter? > Slot "L": > [1] 10 > >> wt.filter("d6") #OK > An object of class ?wt.filter? > Slot "L": > [1] 6 > > > Thank you in advance to anyone who takes care of reported bugs in > CRAN packages. > Maura > > > tutti i telefonini TIM! > > > [[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.