You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 satır
730B

  1. ---
  2. output: js4shiny::html_document_plain
  3. ---
  4. ```{r frappeChart, message=FALSE}
  5. library(dplyr)
  6. library(tidyr)
  7. library(babynames)
  8. data <-
  9. babynames %>%
  10. filter(
  11. name %in% c("Ruth", "August"),
  12. year >= 1980
  13. ) %>%
  14. group_by(year, name) %>%
  15. summarize(n = sum(n)) %>%
  16. ungroup() %>%
  17. pivot_wider(year, name, values_from = n)
  18. frappeCharts::frappeChart(
  19. data,
  20. title = "This. Is. Awwesome.",
  21. elementId = "name-chart",
  22. lineOptions = list(regionFill = TRUE),
  23. axisOptions = list(xIsSeries = TRUE),
  24. colors = c("#466683", "#44bc96"),
  25. width = "100%",
  26. tooltipOptions = list(
  27. formatTooltipX = htmlwidgets::JS("d => 'Year: ' + d"),
  28. formatTooltipY = htmlwidgets::JS("d => d + ' babies'")
  29. )
  30. )
  31. ```