Type: Package
Title: Import Data from Our World in Data
Version: 1.4.2
Description: Import data from 'Our World in Data', an organisation which publishes research and data on global economic and social issues.
URL: <https://github.com/piersyork/owidR>, <https://ourworldindata.org/>, <https://github.com/owid/covid-19-data/>
Imports: data.table, rvest, jsonlite, httr, xml2, purrr, curl, magrittr
Depends: R (≥ 3.5.0)
License: MIT + file LICENSE
Encoding: UTF-8
Language: en-GB
RoxygenNote: 7.2.3
Suggests: testthat (≥ 3.0.0), utils, knitr, rmarkdown
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2023-10-30 20:23:33 UTC; piers
Author: Piers York [aut, cre]
Maintainer: Piers York <piersyork@gmail.com>
Repository: CRAN
Date/Publication: 2023-10-30 20:40:17 UTC

Get data from Our World in Data

Description

Get a dataset used in an OWID chart.

Usage

owid(chart_id = NULL, rename = NULL, tidy.date = TRUE, ...)

Arguments

chart_id

The chart_id as returned by owid_search

rename

Rename the value column. Currently only works if their is just one value column.

tidy.date

If TRUE then a year column that should be a date column will automatically detected and transformed. If FALSE then the Year column will be kept as is. Defaults to TRUE.

...

Not to be used.

Value

A data.table of an owid dataset with the added class 'owid'.

Examples


owid_search("emissions")
emissions <- owid("per-capita-ghg-emissions")



Get the Our World in Data covid-19 dataset

Description

Get the Our World in Data covid-19 dataset

Usage

owid_covid()

Value

A dataframe with multiple variables on the covid-19 pandemic.


Description

Search the data sources used in OWID charts

Usage

owid_search(term)

Arguments

term

A search term

Value

A matrix of chart titles and chard ids

Examples


# returns the titles and chart_ids of all charts containing the word 'emissions'
owid_search("emissions")



Get source information on an OWID dataset

Description

A function to get source information from an OWID dataset and display it in the R console.

Usage

owid_source(data)

Arguments

data

A dataset returned from owid().

Value

Displays the information in an easy to read format in the R console, also returns a list of data information.

Examples


rights <- owid("human-rights-scores")
owid_source(rights)


View an OWID chart in your browser

Description

A function that opens the original OWID chart in your browser.

Usage

view_chart(x)

Arguments

x

Either a dataset returned by owid(), or a chart_id.

Value

Opens the chart in your browser.

Examples


firearm_suicide <- owid("suicide-rate-by-firearm")
view_chart(firearm_suicide)