Skip to content

Instantly share code, notes, and snippets.

@jsta
Last active May 18, 2022 07:36
Show Gist options
  • Save jsta/3fabde8c4a57bbe86aae1a41280d8674 to your computer and use it in GitHub Desktop.
Save jsta/3fabde8c4a57bbe86aae1a41280d8674 to your computer and use it in GitHub Desktop.
Import from datasets package
#' datasets.test
#' @importFrom datasets co2
#' @export
ds_test <- function(x){
datasets::co2[x]
}
Package: datasets.test
Title: What the Package Does (one line, title case)
Version: 0.0.0.9000
Authors@R: c(person("Joseph", "Stachelek", email = "[email protected]", role = c("aut", "cre")))
Description: What the package does (one paragraph).
Depends:
R (>= 3.3.3)
Imports:
datasets
License: GPL (>= 2)
Encoding: UTF-8
LazyData: true
RoxygenNote: 5.0.1
@EAVWing
Copy link

EAVWing commented Aug 8, 2018

Did you ever get an answer on this? I'm having the same issue.

Undefined global functions or variables:
state.abb state.name
Consider adding
importFrom("datasets", "state.abb", "state.name")
to your NAMESPACE file.

@sigbertklinke
Copy link

Had the same problem. What worked for me:

  1. Delete the line "#' @importFrom datasets co2"
  2. No entry "datasets" in the "Imports" list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment