r - Trouble relying on third party package imports in my package -
my package uses ggplot2
extensively make custom plots. import ggplot2
in namespace
file. can build, install, , load package r without errors. when call function package, complains can't find function in imported package. function called had absolute nothing plotting , didn't make use of ggplot2
. how can make function calls package work without these types of errors?
error in theme_beata() (from plot.r#14) : not find function "theme_classic"
the first function erroring is:
#' custom ggplot2 theme beata #' @import ggplot2 #' @family themes #' inheritparams ggplot2::theme_classic #' @export theme_beata <- function(base_size = 14, base_family="serif", ticks = true) { ret <- theme_classic() + theme(axis.line = element_line(size=0.6), axis.text = element_text(size = base_size), axis.title = element_text(size= base_size + 2), title = element_text(size=base_size + 4)) if (!ticks) { ret <- ret + theme(axis.ticks = element_blank()) } ret }
i using devtools
, roxygen2
document package. discovered getting error when running document()
.
> document() updating pkg documentation loading pkg error in theme_beata() (from plot.r#11) : not find function "theme_classic" > traceback() 13: theme_beata() 12: as.vector(y) 11: setdiff(names(theme_gray()), names(new)) 10: ggplot2::theme_set(theme_beata()) @ plot.r#25 9: eval(expr, envir, enclos) 8: eval(exprs[i], envir) 7: source_one(file, envir = envir) 6: source_many(paths, env) 5: force(code) 4: in_dir(file.path(pkg$path, "r"), source_many(paths, env)) 3: load_code(pkg) 2: load_all(pkg) 1: document()
from reading hadley's book on packaging, don't think description
matters in terms of exports, below bottom part:
depends: r (>= 3.1.0) license: file license lazydata: false imports: dplyr (>= 0.4.0), tidyr (>= 0.1.0), xlconnect, pryr, stringr, devemf, assertthat, grid, ggplot2, ggthemes, ggally, broom, scales suggests: lattice
my namespace
has following imports:
import(xlconnect) import(dplyr) import(ggplot2) import(ggthemes) import(stringr) import(tidyr)
Comments
Post a Comment