roxygen2中方法的命名空间

时间:2019-03-09 22:28:58

标签: r package roxygen2

我正在更新名为psda的软件包,但无法更正错误消息:

  

`Erro:“ psda”的包或名称空间加载失败:加载名称空间“ psda”时找不到对象“ na.omit”。

如何解决问题?

我使用roxygen2

我的功能由下面的代码给出。

#' Handle Missing Values in Polygoal Objects
#' 
#' @description The function omits missing polygons in class "\emph{polygonal}".
#' @method na.omit polygonal
#' @rdname na.omit
#' @param polygons objects of the class "\emph{polygonal}".
#' @return polygons an object of the class "\emph{polygonal}" without missing values.
#' @examples 
#' y <- psim(5, 3)
#' y[[1]] <- NA
#' na.omit(y) 
#' @export
na.omit.polygonal <- function(polygons){
  missing_polygons <- is.na(polygons)
  if(sum(missing_polygons != 0)){
    polygons <- polygons[!missing_polygons]
  }
  class(polygons) <- 'polygonal'
  polygons
}

编辑

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252    LC_MONETARY=Portuguese_Brazil.1252
[4] LC_NUMERIC=C                       LC_TIME=Portuguese_Brazil.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] psda_1.3.0      testthat_2.0.0  backports_1.1.3

loaded via a namespace (and not attached):
 [1] remotes_2.0.2     purrr_0.2.5       lattice_0.20-35   colorspace_1.3-2  usethis_1.4.0    
 [6] yaml_2.2.0        base64enc_0.1-3   rlang_0.2.1       pkgbuild_1.0.2    pillar_1.2.3     
[11] glue_1.2.0        withr_2.1.2       sp_1.2-7          sessioninfo_1.1.1 plyr_1.8.4       
[16] stringr_1.3.1     rgeos_0.3-28      commonmark_1.6    munsell_0.5.0     gtable_0.2.0     
[21] raster_2.6-7      devtools_2.0.1    memoise_1.1.0     callr_3.0.0       ps_1.1.0         
[26] Rcpp_0.12.17      scales_0.5.0      desc_1.2.0        pkgload_1.0.2     fs_1.2.6         
[31] ggplot2_2.2.1     digest_0.6.15     stringi_1.1.7     processx_3.2.0    grid_3.5.1       
[36] rprojroot_1.3-2   cli_1.0.0         tools_3.5.1       magrittr_1.5      tibble_1.4.2     
[41] lazyeval_0.2.1    crayon_1.3.4      xml2_1.2.0        prettyunits_1.0.2 roxygen2_6.1.0   
[46] assertthat_0.2.0  rstudioapi_0.7    R6_2.2.2          compiler_3.5.1 

0 个答案:

没有答案