gbganalyst / chartkickR

This is an implementation of the Chartkick.js library in R using the htmlwidgets framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chartkickR

This is an implementation of the chartkickR.js library in R using the htmlwidgets framework. * One unique thing about chartkickR is that you can create visual with just one line of code

Installation

To install the latest development version from GitHub:

install.packages("remotes")
remotes::install_github("BWOlatunji/chartkickR")

How to use

Example - Palmer penguins data set

library(chartkickR)
library(palmerpenguins)
library(tidyverse)


p_data <- palmerpenguins::penguins |> select(bill_length_mm,bill_depth_mm)

# Scatter plot
chartkickR::chartkickR(data = p_data,x=bill_length_mm,y=bill_depth_mm,
                       type = "ScatterChart")

# Pie chart             

palmerpenguins::penguins  |> count(species) |> 
  set_names(c("species", "count")) |> 
  chartkickR::chartkickR(type = "PieChart", x=species, y= count,
                         colors = list("#4f86f7", "#fc5a8d","yellow"))

# Multiple Series Bar
bar_series_data <- penguins |> 
  group_by(year) |> 
  count(species)

chartkickR(data=bar_series_data, x=year, y=n,
           group=species, type = "BarChart",curve = TRUE)

Download and save chart

The output can be downloaded and save as an image i.e. png file

# Pie chart             
                       
palmerpenguins::penguins  |> count(species) |> 
  set_names(c("species", "count")) |> 
  chartkickR::chartkickR(type = "PieChart", x=species, y= count,
                         colors = list("#4f86f7", "#fc5a8d","yellow"),
                         download = list(background= "#fff"))

More examples

Check out the rmarkdown file: "inst/examples/chartkickR_demo.Rmd"

References:

About

This is an implementation of the Chartkick.js library in R using the htmlwidgets framework.

License:Other


Languages

Language:HTML 83.4%Language:JavaScript 16.2%Language:R 0.5%