R软件包创建问题 [英] R package creation questions

查看:100
本文介绍了R软件包创建问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个R包,但是我在本主题中是一个全新的人,即使我已经检查了一些出色的资源,例如Hadley Wickham的

I want to create an R package, but I'm completely new in this topic, and even though I've already checked some excellent resources like Hadley Wickham's R packages book, I've a couple of questions that I'd like to clarify:

  1. 是否需要导入stats程序包才能使用lm功能?
  2. 由于我不能编写library(magrittr),因此如何使用magrittr程序包中的管道运算符%>%?
  3. 如果我创建了一个用于实用程序的功能,但最终用户不应该使用它,该如何隐藏呢?
  1. Do I need to import the stats package to make use of the lm function?
  2. How can I make use of the piping operator %>% in the magrittr package since I can not write library(magrittr)?
  3. If I created a function that is for utility purposes but it shouldn't be available to the end user, how can I hide it?

任何帮助将不胜感激!

推荐答案

我需要导入stats软件包以使用lm函数吗?

Do I need to import the stats package to make use of the lm function?

不.它是自动加载的.您只需要导入R引导时未加载的软件包(如晶格)

No. It's loaded automatically. You only need to import for packages not loaded when R boots (like lattice)

如何使用magrittr软件包中的管道运算符%>% 因为我不能写图书馆(magrittr)?

How can I make use of the piping operator %>% in the magrittr package since I can not write library(magrittr)?

我将其导入,就像Hadley在 HERE 中一样dplyr:

I'd import it as Hadley does HERE in dplyr:

#' @importFrom magrittr %>%
#' @name %>%
#' @export
#' @rdname chain
#' @usage lhs \%>\% rhs
NULL

如果您不使用 roxygen2 进行记录,我会真的推荐它,但是如果您正在阅读Hadley的教程,则可能会走这条路.

If you're not using roxygen2 to document I'd really recommend it, but if you're reading Hadley's tutorial you probably will go that route.

这篇关于R软件包创建问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆