When writing my own R package, I can't seem to get other packages to import correctly

前端 未结 2 1436
一整个雨季
一整个雨季 2020-12-14 14:56

Alright, first attempt at writing an R package and I\'m stuck. Here\'s how I create the package:

package.skeleton(\"pkg\",code_files=some.filenames)
roxygeni         


        
相关标签:
2条回答
  • 2020-12-14 15:36

    The warnings are because data.table and lubridate both define a symbol hour, etc; see data.table::hour and lubridate::hour. You could avoid this by importing just the functions from lubridate / data.table that you want, rather than the whole package; a standard NAMESPACE file would contain

    importFrom(lubridate, hour)
    

    for instance. In roxygen2 you would use the tag:

    @importFrom lubridate hour
    

    The MATCH problem is probably because merge is dispatching incorrectly, probably because zoo should have in its name space S3method(merge, zoo) rather than export(merge.zoo), as described in Writing R Extensions, 1.6.2. The solution here is to contact the maintainer of zoo, packageDescription('zoo')$Maintainer (the maintainer is sufficiently versed in R that I feel like I've mis-diagnosed...).

    0 讨论(0)
  • 2020-12-14 15:38

    As a temporary workaround for the MATCH error, I've had success listing the zoo package under the Depends: section of the package's DESCRIPTION file.

    0 讨论(0)
提交回复
热议问题