inst/doc/data_management.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup, echo = FALSE------------------------------------------------------
library(ggsankeyfier)

## ----pivot, echo=TRUE---------------------------------------------------------
## first get a data set with a wide format:
data(ecosystem_services)

## pivot to long format for plotting:
es_long <-
  pivot_stages_longer(
    ## the data.frame we wish to pivot:
    data        = ecosystem_services,
    ## the columns that represent the stages:
    stages_from = c("activity_type", "pressure_cat",
                    "biotic_realm", "service_division"),
    ## the column that represents the size of the flows:
    values_from = "RCSES"
  )

## ----pivot_names, echo=TRUE, include=TRUE-------------------------------------
names(es_long)

Try the ggsankeyfier package in your browser

Any scripts or data that you put into this service are public.

ggsankeyfier documentation built on May 29, 2024, 1:44 a.m.