Skip to contents

Converts GPT strings reporting categories to factors, using proper levels derived from the target factor.

Usage

parse_gpt_fctr(from_str, to_fct)

Arguments

from_str

(chr) The character vector to parse.

to_fct

(fct) The target factor

Value

(fct) The parsed factor.

Note

The target factor it is supposed that will be overwritten by the resulting factor of this function.

Examples

parse_gpt_fctr(c("si", "no", "forse"), factor(c("si", "no")))
#> [1] si           no           Non rilevato
#> Levels: no si Non rilevato