Htmlwidgets for proportions-chart, built with {packer}.
You can install the released version of {bar} from GitHub with:
remotes::install_github("dreamRs/bar")
Installed capacities to produce energy in France (source eco2mix):
Code:
library(bar)
# Installed capacities by sectors in France
# source: https://www.rte-france.com/eco2mix/les-chiffres-cles-de-lelectricite
installed <-data.frame(
sector = c("Bioenergies", "Fuel oil", "Coal", "Solar", "Gas", "Wind", "Hydraulic", "Nuclear"),
value = c( 2119L, 2892L, 2978L, 9613L, 12196L, 16727L, 25483L, 62250L)
)
# Visualize data
bar(
data = installed,
colors = list(
"Bioenergies" = "#156956",
"Fuel oil" = "#80549f",
"Coal" = "#a68832",
"Solar" = "#d66b0d",
"Gas" = "#f20809",
"Wind" = "#72cbb7",
"Hydraulic" = "#2672b0",
"Nuclear" = "#e4a701"
)
)
Install {packer} (see packer's documentation).
Install nodes modules with:
packer::npm_install()
Modify srcjs/widgets/bar.js
, then run:
packer::bundle()
Re-install package and try bar()
function.