1
votes

I try to build a custom geom to extend ggplot2.

While the function works, I am not able to build the package as I have the following error message:

    ==> devtools::document(roclets=c('rd', 'collate', 'namespace'))

    Updating ggvis documentation
Loading ggvis
    Error in ggproto("GeomDash", Geom, required_aes = c("x", "y"), non_missing_aes = c("linetype",  (from geom_dash.R#57) : 
impossible de trouver la fonction "ggproto"
    Calls: suppressPackageStartupMessages ... withr_with_dir -> force -> source_many -> source_one -> eval -> eval
Ex�cution arr�t�e

Exited with status 1.

I installed the dev version of ggplot2 as recommanded by Hadley. With no success. For some reason it does not show an error when I try with a dummy function such as:

    f <- function(x){
        return(ggproto(x))}

But it doesn't work even with the initial code of geom_segment or by integrating the ggproto function in the package's folder.

You can find my function here

I've already created a package to extend ggplot2 with no problem. It still builds just fine.

Any suggestion? Cheers.

1
You need to update you NAMESPACE file (or have Roxygen update it for you). If you look at the NAMESPACE of your problem package, it only has a single line, and it's an export line--no namespaces are imported. Compare this to the NAMESPACE of your working package, which has lines to import() each of the packages mentioned as Imports in your DESCRIPTION file. - Gregor Thomas
I fill have a look. Isn't Roxygen supposed to create the NAMESPACE file according to the DESCRIPTION file ? - Hobo Sheep
Especially if the geom_function contains the following lines: #' @import ggplot2 grid #' @importFrom ggplot2 ggproto - Hobo Sheep

1 Answers

0
votes

The problem was solved by editing the NAMESPACE as suggested by @Gregor.

Removing the existing NAMESPACE file and running

    devtools::document()

allowed the creation of a clean NAMESPACE file containing the required exports and imports.