Learn R Programming

fixest (version 0.12.1)

as.dict: 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)

Value

It returns a named character vector.

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.

Author

Laurent Berge

Details

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

See Also

etable, setFixest_dict

Examples

Run this code

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

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

as.dict(x)



Run the code above in your browser using DataLab