Skip to content

clean up the data objects in examples? #837

Closed
@yihui

Description

@yihui

e.g. a new data object movies was created in the example of geom_histogram, and it can cause problems if we continue to run the examples of geom_violin:

library(ggplot2)
example('geom_histogram', ask = FALSE)
example('geom_violin', ask = FALSE)
gm_vln> m <- ggplot(movies, aes(y = votes, x = rating,
gm_vln+    group = round_any(rating, 0.5)))

gm_vln> m + geom_violin()
Error in `$<-.data.frame`(`*tmp*`, "n", value = 3L) : 
  replacement has 1 row, data has 0

gm_vln> m + geom_violin() + scale_y_log10()
Error in `$<-.data.frame`(`*tmp*`, "n", value = 3L) : 
  replacement has 1 row, data has 0

gm_vln> m + geom_violin() + coord_trans(y = "log10")
Error in `$<-.data.frame`(`*tmp*`, "n", value = 3L) : 
  replacement has 1 row, data has 0
Error in log(x, base) : non-numeric argument to mathematical function

It seems the first three errors were in try(), so there is no way to trace them back; it might be an environment/variable scope problem. I do not know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions