我正在开发一个包并想导入所有dplyr功能,所以我添加了
#' @import dplyr
对于我的函数,它生成了一个如下所示的名称空间:
`# Generated by roxygen2 (4.1.1): do not edit by hand
export(process_text)
export(quick_match)
import(dplyr)`
但是当我使用加载包时devtools::load_all()出现错误:
dplyr 功能不可用。
我究竟做错了什么?
您还需要将其导入您的说明文件中。像这样的东西:
Package: <name>
Version: <version>
Date: <date>
Title: <title>
Author: <author>
Maintainer: <maintainer>
Depends:
R (>= 2.13.0)
Imports:
dplyr
Description: <description>
License: GPL (>= 2)
事实证明,您需要将包列在 Depends 以及 DESCRIPTION 文件的 Imports 部分中。以下为我解决了这个问题。
Package: stringmatch
Title: Q-Gram filtering for approximate string matching
Version: 0.0.0.9000
Authors@R:
Description: An implementation of q-gram filtering for fast levenstein distance matching
Depends:R (>= 3.2.2),
dplyr
Imports:
dplyr,