MyNixOS website logo
Description

Data Package Manager for R.

Create, install, and summarise data packages that follow the Open Knowledge Foundation's Data Package Protocol.

<img src="img/logo.png" align="right" height="80"/ alt="dmpr logo">

Data Package Manager for R

Version: 0.1.9 CRAN Version Build Status CRAN Monthly Downloads CRAN Total Downloads

Description

The R package for creating and installing data packages that follow the Open Knowledge Foundation's Data Package Protocol.

dpmr has three core functions:

  • datapackage_init: initialises a new data package from an R data frame and (optionally) a meta data list.

  • datapackage_install: installs a data package either stored locally or remotely, e.g. on GitHub.

  • datapackage_info: reads a data package's metadata (stored in its datapackage.json file) into the R Console and (optionally) as a list.

Examples

Create Data Packages

To initiate a barebones data package in the current working directory called My_Data_Package use:

# Create fake data
A <- B <- C <- sample(1:20, size = 20, replace = TRUE)
ID <- sort(rep('a', 20))
Data <- data.frame(ID, A, B, C)

datapackage_init(df = Data, package_name = 'My_Data_Package')

This will create a data package with barebones metadata in a datapackage.json file. You can then edit this by hand.

Alternatively, you can also create a list with the metadata in R and have this included with the data package:

meta_list <- list(name = 'My_Data_Package',
                    title = 'A fake data package',
                    last_updated = Sys.Date(),
                    version = '0.1',
                    license = data.frame(type = 'PDDL-1.0',
                            url = 'http://opendatacommons.org/licenses/pddl/'),
                    sources = data.frame(name = 'Fake',
                            web = 'No URL, its fake.'))

datapackage_init(df = Data, meta = meta_list)

Note if you don't include the resources fields in your metadata list, then they will automatically be added. These fields identify the data files' paths and data schema.

Installing Data Packages

Locally

To load a data package called gdp stored in the current working directory use:

gdp_data <- datapackage_install(path = 'gdp/')

From the web

You can install a package stored remotely using its URL. In this example we directly download the gdp data package from GitHub using the URL for its zip file:

URL <- 'https://github.com/datasets/gdp/archive/master.zip'
gdp_data <- datapackage_install(path = URL)

Get Data Package Metadata

Use datapackage_info to read a data package's metadata into R:

# Print information when working directory is a data package
datapackage_info()

To-do for v0.2

  • [ ] datapackage_update for updating a data package's data and metadata.

  • [ ] Specify data variable descriptions in meta list.

  • [ ] Load inline data from the datapackage.json file.

  • [ ] Load data from a GitHub repo using GitHub usernames and repos.


Licensed under GPL-3

Metadata

Version

0.1.9

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows