load_cp_data: Load cumulative probit data from file

Description Usage Arguments Value Examples

View source: R/data_io.R

Description

Two inputs are needed, the path to the data file (data_file) and a data frame with information on variables to use (var_info; see [load_var_info]).

Only variables with entries in var_info are kept (accounting for the possibility that some are left/right variables).

Usage

1
load_cp_data(data_file, var_info)

Arguments

data_file

The .csv data file

var_info

The data frame with variable information (see [load_var_info])

Value

A named list containing 1) a data frame containing the cumulative probit data ("cp_df") and 2) the cumulative probit problem file ("problem")

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Load data file path from package yada
data_file <- syanalysis_name.file("extdata","US.csv",package="yada")
print(data_file)

# Load var_info_file from package yada
var_info_file <- syanalysis_name.file("extdata","US_var_info.csv",package="yada")
var_info <- load_var_info(var_info_file)  # load var info file as data frame
head(var_info)

# Call load_cp_data to format data and problem file for cumulative probit
cp_data <- load_cp_data(data_file, var_info)
head(cp_data$cp_df)  # Top rows of cumulative probit data frame
head(cp_data$problem)  # cumulative probit problem as list

MichaelHoltonPrice/yada documentation built on Sept. 19, 2021, 11:27 p.m.