dw_data_to_chart: Fill a Datawrapper chart with data from R

View source: R/dw_data_to_chart.R

dw_data_to_chartR Documentation

Fill a Datawrapper chart with data from R

Description

\lifecycle

stable Uploads a dataframe to Datawrapper, returns a message.

Usage

dw_data_to_chart(
  x,
  chart_id,
  parse_dates = TRUE,
  api_key = "environment",
  format = c("csv", "tsv")
)

Arguments

x

Required. A R object of class 'data.frame',to be uploaded as the Datawrapper data.

chart_id

Required. A Datawrapper-chart-id as character string, usually a five character combination of digits and letters, e.g. "aBcDe". Or a dw_chart-object.

parse_dates

Optional. Defaults to TRUE. Should columns that contain a Date or as POSIX-object be automatically converted to a character vector?

api_key

Optional. A Datawrapper-API-key as character string. Defaults to "environment" - tries to automatically retrieve the key that's stored in the .Reviron-file by datawrapper_auth.

format

Optional. Switch between csv and tsv representation of data for upload. Might be more forgiving towards commas in strings. Recommended to stick with the default (csv).

Value

A terminal message.

Note

This function uploads a R-dataframe to Datawrapper.

Author(s)

Benedict Witzenberger

Examples


## Not run: dw_data_to_chart(df, "aBcDE") # uses the preset key in the .Renviron-file

## Not run: dw_data_to_chart(df, chart_id = "a1B2Cd", api_key = "1234ABCD") # uses the specified key

## Not run: dw_data_to_chart(df, chart_id = "a1B2Cd", parse_dates = FALSE) # do not parse Dates to characters


munichrocker/DatawRappr documentation built on March 20, 2024, 6:08 a.m.