Package 'codec'

Title: Community Data Explorer for Cincinnati
Description: This repository serves as the definition of the CoDEC data specifications and provides helpers to create, validate, release, and read CoDEC data.
Authors: Cole Brokamp [aut, cre], Erika Manning [aut], Andrew Vancil [aut]
Maintainer: Cole Brokamp <[email protected]>
License: GPL (>= 3)
Version: 2.2.0
Built: 2024-11-06 04:24:53 UTC
Source: https://github.com/geomarker-io/codec

Help Index


as_codec_dpkg

Description

Convert a tibble to a data package (dpkg) object in R while checking it against CoDEC data specifications:

Usage

as_codec_dpkg(
  x,
  name,
  version,
  title = character(),
  description = character(),
  homepage = character()
)

Arguments

x

data.frame or tibble meeting CoDEC data specifications above

name

see dpkg::as_dpkg()

version

see dpkg::as_dpkg()

title

see dpkg::as_dpkg()

description

see dpkg::as_dpkg()

homepage

see dpkg::as_dpkg()

Details

  1. The data must include a census tract identifier column (i.e., census_tract_id_2000, census_tract_id_2010, or census_tract_id_2020). The column must contain 11-digit GEOID identifiers for every census tract in Hamilton County, OH.

  2. The data includes a year column (year), an integer year representing the vintage of the data (e.g. 2021). The data can optionally include a month column (month), an integer month of the year.

Data must be structured in a tidy format such that each row is an observation for a specific census tract at a specific year (and month).

Value

a dpkg object


CoDEC colors

Description

CoDEC colors

Usage

codec_colors(n = NULL)

Arguments

n

a numeric vector of color numbers or character vector of color names; if NULL returns named vector of available colors

Examples

plot(1:8, rep(1, 8), col = codec_colors(1:8),
  pch = 19, cex = 10, axes = FALSE, xlab = "", ylab = "")
text(1:8, rep(1.1, 8), labels = names(codec_colors()))

Convert a CoDEC dpkg into an sf object

Description

The required census tract identifier column name is used to merge in tract geographies from the cincy package.

Usage

codec_dpkg_as_sf(x)

Arguments

x

a CoDEC dpkg

Value

an sf object that is a codec dpkg with an added geometry column

Examples

get_codec_dpkg("drivetime-v0.2.2") |>
  codec_dpkg_as_sf()

Put a dpkg into the public CoDEC S3 bucket

Description

The AWS CLI tool must be installed and authenticated to write to ⁠s3://geomarker-io/codec_data⁠. The resulting data package will be available publicly.

Usage

codec_dpkg_s3_put(x)

Arguments

x

a data package (dpkg) object, ideally created with as_codec_dpkg() to ensure the data meets CoDEC specifications

Value

character string URI of uploaded resource

Examples

## Not run: 
# use aws command line to login interactively via profile sso account"
system2("aws", c("sso", "login", "--profile", "geomarker-io"))
# make sure to set AWS_PROFILE so the AWS CLI tool knows to use it by default"
Sys.setenv("AWS_PROFILE" = "geomarker-io")

## End(Not run)

Read a dpkg from the public CoDEC repository into R

Description

Public data packages are downloaded from ⁠gh://geomarker-io/codec/⁠ using dpkg::stow() to cache a local copy in the user's data directory.

Usage

get_codec_dpkg(codec_dpkg, overwrite = FALSE)

Arguments

codec_dpkg

name of CoDEC dpkg

overwrite

logical; re-download the remote file even though a local file with the same name exists?

Value

a CoDEC data package (see dpkg::as_dpkg())

Examples

get_codec_dpkg("drivetime-v0.2.2")