daranzolin / clockwork

Create cyclical, radial line charts with d3.js :clock1:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clockwork

CRAN log

clockwork creates a cyclical, radial line charts. Cycle through years, months, days, hours, minutes, or campaigns.

Installation

You can install the released version of clockwork from GitHub with:

remotes::install_github("daranzolin/clockwork")

Example 1: Daily Births by Year

library(tidyverse)
library(lubridate)
births <- read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2018/2018-10-02/us_births_2000-2014.csv")
births <- births %>% 
  unite("date", date_of_month, month, year, sep = "-") %>% 
  mutate(date = lubridate::dmy(date),
         day_of_year = yday(date),
         year = year(date)) 

births %>% 
  filter(year %in% 2008:2014) %>% 
  clockwork(x = day_of_year,
            y = births,
            cycle = year,
            cycle_label = "Year: ",
            show_cycle_stats = TRUE,
            x_ticks = 12) 

Control loop duration, stroke line colors/opacity, and font size/family with the cw_style function.

About

Create cyclical, radial line charts with d3.js :clock1:

License:Other


Languages

Language:JavaScript 64.6%Language:R 35.4%