我正在开发一个包,其中包含一个ReferenceClass具有data.table类字段(在包中定义)的data.table包:
MyRC <- setRefClass("MyRC", fields = list(myfield="data.table"))
当我写入包DESCRIPTION文件时:
Depends:
data.table
一切安好。但是我听说应该尽可能避免使用Depends,所以我将其重写为:
Imports:
data.table
然而,这在构建包时会引发错误:
# Error in refClassInformation(Class, contains, fields, methods, where) :
# class "data.table" for field 'myfield' is not defined
Depends在这种情况下我真的被迫使用吗?