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

半世苍凉 提交于 2019-11-28 22:38:29
Martin Morgan

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...).

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!