hafen / trelliscopejs

TrelliscopeJS R Package
https://hafen.github.io/trelliscopejs
Other
263 stars 36 forks source link

Error in deparse_vector(x) : x must be a character vector. #66

Closed JiaxiangBU closed 5 years ago

JiaxiangBU commented 5 years ago

I get this error when I run the code, Error in deparse_vector(x) : x must be a character vector.. Here is a reproducible example.

library(ggplot2)
library(dplyr)
library(gapminder)
library(trelliscopejs)

# Group by country and create the two new variables
gap <- gapminder %>%
  group_by(country) %>%
  mutate(
    delta_lifeExp = tail(lifeExp, 1) - head(lifeExp, 1),
    ihme_link = paste0("http://www.healthdata.org/", country))

# Add the description
gap$delta_lifeExp <- cog(gap$delta_lifeExp, desc = "Overall change in life expectancy")

# Specify the default label
gap$ihme_link <- cog(gap$ihme_link, default_label = TRUE)

ggplot(gap, aes(year, lifeExp)) +
  geom_point() +
  facet_trelliscope(~ country + continent,
    name = "lifeExp_by_country",
    desc = "Life expectancy vs. year for 142 countries.",
    nrow = 2, ncol = 3,
    scales = c("same", "sliced"))

The code is from the tutorial by Ryan Hafen on DataCamp.

hafen commented 5 years ago

Thanks for the report. I have fixed it in the master branch. Will still have this issue on CRAN until I am able to get it updated there.