代码之家  ›  专栏  ›  技术社区  ›  TheGoat

在R中使用带modwt的apply函数时未使用的参数

  •  0
  • TheGoat  · 技术社区  · 7 年前

    这个代码以前为我工作过,没有任何错误,直到今天晚上我才收到这个错误。我已经阅读了一些关于未使用参数的其他线程,我已经重新启动了会话多次,但没有成功使用 .rs.restartR()

    Error in FUN(newX[, i], ...) : unused argument (filter = "la8")
    

    当我从apply函数中删除filter参数时,错误消失了,但它会把我的其余代码搞砸。

    ###This section computes the wavelet coefficients for each of the variables####
    #calculates the wavelet coefficients for each of the cells in the XTS object
    wideRawWavelet <- apply(wideRawXTS, 
                            2, 
                            modwt,
                            n.level = 10,
                            boundary = "periodic",
                            filter = "la8")
    

    我已经查阅了modwt(?modwt)的帮助指南,并且filter参数是有效的,所以我完全不知道它为什么会抛出错误。

    我已经检查了其余代码中是否有重复的函数名,但没有。

    Here 是指向我正在使用的wideRawXTS文件的dput的链接

    > conflicts(detail=TRUE)
    $.GlobalEnv
    [1] "colnames" "eigen"   
    
    $`package:waveslim`
    [1] "dwt"    "idwt"   "imodwt" "modwt"  "mra"    "pm"    
    
    $`package:rJava`
     [1] "show"          "show"          "show"          "head"          "str"           "tail"          "new"           "show"         
     [9] "anyDuplicated" "duplicated"    "rev"           "sort"          "unique"       
    
    $`package:ggplot2`
    [1] "arrow"    "unit"     "Position"
    
    $`package:Rcpp`
    [1] "show"       "show"       "show"       "prompt"     "initialize" "show"       "formals<-" 
    
    $`package:wavelets`
    [1] "dwt"    "idwt"   "imodwt" "modwt"  "mra"   
    
    $`package:xts`
    [1] "first" "last" 
    
    $`package:mice`
    [1] "version"
    
    $`package:VIM`
    [1] "sleep"
    
    $`package:data.table`
     [1] "first"   "last"    "dcast"   "melt"    "hour"    "isoweek" "mday"    "minute"  "month"   "quarter" "second"  "wday"    "week"   
    [14] "yday"    "year"   
    
    $`package:grid`
    [1] "arrow" "unit" 
    
    $`package:colorspace`
    [1] "show"   "show"   "show"   "plot"   "coerce" "show"  
    
    $`package:imputeTS`
    [1] "na.locf"
    
    $`package:reshape2`
    [1] "dcast" "melt" 
    
    $`package:lubridate`
     [1] "show"        "show"        "hour"        "isoweek"     "mday"        "minute"      "month"       "pm"          "quarter"    
    [10] "second"      "show"        "wday"        "week"        "yday"        "year"        "Arith"       "Compare"     "show"       
    [19] "as.difftime" "date"        "intersect"   "setdiff"     "union"      
    
    $`package:zoo`
    [1] "na.locf"         "as.Date"         "as.Date.numeric"
    
    $`package:gplots`
    [1] "lowess"
    
    $`package:stats`
    [1] "lowess"
    
    $`package:graphics`
    [1] "plot"
    
    $`package:utils`
    [1] "head"   "prompt" "str"    "tail"  
    
    $`package:datasets`
    [1] "sleep"
    
    $`package:methods`
     [1] "show"       "show"       "show"       "Arith"      "coerce"     "Compare"    "initialize" "new"        "show"       "body<-"    
    [11] "kronecker" 
    
    $`package:base`
     [1] "anyDuplicated"   "as.Date"         "as.Date.numeric" "as.difftime"     "body<-"          "colnames"        "date"           
     [8] "duplicated"      "eigen"           "formals<-"       "intersect"       "kronecker"       "Position"        "rev"            
    [15] "setdiff"         "sort"            "union"           "unique"          "version"
    

    另一个建议是使用sessioninfo(),它显示:

    > sessionInfo()
    R version 3.3.2 (2016-10-31)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows >= 8 x64 (build 9200)
    
    locale:
    [1] LC_COLLATE=English_Ireland.1252  LC_CTYPE=English_Ireland.1252    LC_MONETARY=English_Ireland.1252 LC_NUMERIC=C                    
    [5] LC_TIME=English_Ireland.1252    
    
    attached base packages:
    [1] grid      stats     graphics  grDevices utils     datasets  methods   base     
    
    other attached packages:
     [1] W2CWM2C_2.0        wavemulcor_2.1.0   waveslim_1.7.5     xlsx_0.5.7         xlsxjars_0.6.1     rJava_0.9-8        ggplot2_2.2.1     
     [8] GGally_1.3.1       RColorBrewer_1.1-2 Amelia_1.7.4       Rcpp_0.12.11       wavelets_0.3-0     MTS_0.33           xts_0.10-0        
    [15] mice_2.30          MissMech_1.0.2     VIM_4.7.0          data.table_1.10.4  colorspace_1.3-2   imputeTS_2.5       corrplot_0.77     
    [22] reshape2_1.4.2     lubridate_1.6.0    zoo_1.8-0          gplots_3.0.1      
    
    loaded via a namespace (and not attached):
     [1] tseries_0.10-42       splines_3.3.2         gtools_3.5.0          TTR_0.23-1            sp_1.2-5              robustbase_0.92-7    
     [7] lattice_0.20-34       quantreg_5.33         quadprog_1.5-5        minqa_1.2.4           Matrix_1.2-7.1        plyr_1.8.4           
    [13] timeDate_3012.100     SparseM_1.77          mvtnorm_1.0-6         scales_0.4.1          gdata_2.18.0          fGarch_3010.82.1     
    [19] lme4_1.1-13           MatrixModels_0.4-1    tibble_1.3.3          mgcv_1.8-15           car_2.1-5             nnet_7.3-12          
    [25] lazyeval_0.2.0        pbkrtest_0.4-7        quantmod_0.4-10       survival_2.41-3       magrittr_1.5          forecast_8.1         
    [31] laeken_0.4.6          nlme_3.1-128          MASS_7.3-45           foreign_0.8-67        class_7.3-14          tools_3.3.2          
    [37] stringr_1.2.0         munsell_0.4.3         e1071_1.6-8           vcd_1.4-3             timeSeries_3022.101.2 stinepack_1.3        
    [43] caTools_1.17.1        rlang_0.1.1           nloptr_1.0.4          bitops_1.0-6          boot_1.3-18           gtable_0.2.0         
    [49] fracdiff_1.4-2        reshape_0.8.6         fBasics_3011.87       KernSmooth_2.23-15    stringi_1.1.5         parallel_3.3.2       
    [55] rpart_4.1-10          DEoptimR_1.0-8        lmtest_0.9-35
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   baptiste    7 年前

    尝试显式添加命名空间,如中所示 wavelets::modwt