This function defines the field of study at level 0 in MAG of records in tbl. To do so, it queries tables in the database that store the field of study of the person. See the details for more information.

define_field(tbl, conn, from, ...)

Arguments

tbl

A query from conn with dbplyr and lazily evaluated.

conn

An object of class SQLiteConnection to a sqlite database.

from

A string with options to be queried: "mag_authors" or "graduates".

...

Additional arguments to be passed to make_tbl_output. If not specified, a lazily evaluated table without limit is returned. Partially specified arguments are completed with dots_tbl_output.

Value

tbl augmented by a column with the name of the field of study at level 0 as defined by MAG.

Details

When using from = "graduates"

The field is defined with a custom mapping between the reported field of study in ProQuest and the fields in MAG. The mapping is stored in the database. A record can have multiple fields, and currently the function returns the first reported. A missing fieldname0_mag indicates that it is not possible to map the field at position 0 in ProQuest to the MAG fields. In future, this may be made more flexible to consider any of the reported fields in ProQuest.

When using from = "mag_authors"

Returns the one field for which the person is observed the most likely to publish over their career. The field is defined based on a confidence score of the likely field of study across all publications in the career.