Skip to contents

Describe one field of an extraction schema

Usage

gr_field(description, type = "string", values = NULL)

Arguments

description

What to look for, in the words you would use to a research assistant. This is the whole instruction the model gets for this field, so "Number of participants randomised, not the number analysed" earns its length.

type

One of "string", "integer", "number", "boolean" or "enum". An "integer" value above .Machine$integer.max is kept as a whole double, so that column is a double whenever one such value is present. A value that carries more than one number, such as "120 (60 per arm)", is recorded as missing rather than run together, and so is one that reads more than one way: a scale word or suffix ("3 million", "12k"), a comma that is neither between groups of three digits nor after a lone zero ("1,5"; "1,204" and "0,85" are read), a fraction in an integer field, and a boolean that is not a plain yes or no ("unclear"). gr_extract() counts such a value in n_unverified rather than reporting the field as not reported. Digits of other scripts (Arabic-Indic, Persian, full-width) and a typeset minus sign are read as they are meant.

values

For type = "enum", the permitted values. A declared value is kept as written, including one such as "null" or "none" that would otherwise read as missing.

Value

A gr_field.

Examples

gr_field("Number of participants randomised", type = "integer")
#> <gr_field integer> Number of participants randomised
gr_field("Overall direction of the result", type = "enum",
         values = c("positive", "null", "mixed", "negative"))
#> <gr_field enum(positive/null/mixed/negative)> Overall direction of the result