Skip to contents

Reads a CSV in which column 1 is the time variable (e.g. calendar year) and columns 2.. are 0/1 indicators of attribute presence at each time point. Two example corpora ship with the package and can be loaded by name; an external CSV can be loaded by passing a path to file.

Usage

ljmds.read.csv(
  name = c("peace_declaration", "inaugural", "eurovision"),
  file = NULL
)

Arguments

name

Built-in dataset name; one of "peace_declaration", "inaugural", or "eurovision". Ignored if file is supplied. Defaults to "peace_declaration".

file

Optional path to a user-supplied CSV. When given, name is ignored and the file is read directly.

Value

A list with components t (numeric n-vector of times), X (n x p binary matrix), keywords (column names of X).

See also

ljmds.pipeline() for the full pipeline at fixed (h, k), ljmds.select() for joint (h, k) selection, and ljmds_data for a description of the bundled CSVs.

Examples

# Built-in Peace Declaration of Hiroshima
d <- ljmds.read.csv("peace_declaration")
dim(d$X)              # 78 95
#> [1] 78 95

# Built-in US Presidential Inaugural Addresses
d <- ljmds.read.csv("inaugural")
dim(d$X)              # 59 106
#> [1]  59 106

# Built-in Eurovision Song Contest country participation
d <- ljmds.read.csv("eurovision")
dim(d$X)              # 68 52
#> [1] 68 52

if (FALSE) { # \dontrun{
# User-supplied CSV (column 1 = year, columns 2.. = 0/1)
d <- ljmds.read.csv(file = "my_corpus.csv")
} # }