jroberayalas
jroberayalas

Reputation: 969

R package creation questions

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

Any help is greatly appreciated!

Upvotes: 0

Views: 255

Answers (1)

Tyler Rinker
Tyler Rinker

Reputation: 109864

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

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

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

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

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

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.

Upvotes: 3

Related Questions