contract_convert {k5}R Documentation

Convert contract names to factor intervals

Description

Can perform one of three rough conversions:

  1. For interval contracts (e.g., "220 - 229", "9% or more", etc.), convert the character strings to proper interval notation.

  2. For contracts with multiple discrete outcomes (e.g., Candidate names), convert the character vector to simple factors.

  3. For markets with a single binary question (e.g., "Will the Democrats have a brokered convention in 2020?"), contracts returned are always "Yes" which is converted to TRUE.

Usage

contract_convert(x, decimal = FALSE)

Arguments

x

A character vector of contract names.

decimal

Should percentages be converted to decimals?

Value

A interval factor, unique factor, or logical vector.


[Package k5 version 0.2.1 Index]