as.dict: Transforms a character string into a dictionary

as.dictR Documentation

Transforms a character string into a dictionary

Description

Transforms a single character string containing a dictionary in a textual format into a proper dictionary, that is a named character vector

Usage

as.dict(x)

Arguments

x

A character scalar of the form "variable 1: definition \n variable 2: definition" etc. Each line of this character must contain at most one definition with, on the left the variable name, and on the right its definition. The separation between the variable and its definition must be a colon followed with a single space (i.e. ": "). You can stack definitions within a single line by making use of a semi colon: "var1: def; var2: def". White spaces on the left and right are ignored. You can add commented lines with a "#". Non-empty, non-commented lines that don't have the proper format witll raise an error.

Details

This function is mostly used in combination with setFixest_dict to set the dictionary to be used in the function etable.

Value

It returns a named character vector.

Author(s)

Laurent Berge

See Also

etable, setFixest_dict

Examples


x = "# Main vars
     mpg: Miles per gallon
     hp: Horsepower

     # Categorical variables
     cyl: Number of cylinders; vs: Engine"

as.dict(x)




fixest documentation built on June 22, 2024, 9:12 a.m.