R: use magrittr pipe operator in self written package Ask Question

R: use magrittr pipe operator in self written package Ask Question

I would like to use the pipe-operator %>% introduced in the magrittr package in a package I wrote myself to chain dplyr data transformations. magrittr is listed as Import in the DESCRIPTION file. After loading my own package and testing the function which uses the pipe-operator I get the following error message:

functionname(parameter, にエラーがあります: 関数 "%>%" が見つかりませんでした

%>%関数のソース コードでに変更してmagrittr::%>%も、パッケージをビルドできなくなるため役に立ちません。

ベストアンサー1

magrittrにリストしていれば正しく動作するはずですDepends。しかし、これはお勧めしません代わりに、 をそのままにしてmagrittrImportsに次の行を追加しますNAMESPACE

importFrom(magrittr,"%>%")

読むことをお勧めしますR拡張機能の作成あなたの質問は、1.1.3 項と 1.5.1 項に記載されています。

おすすめ記事