Closed esul1121 closed 6 months ago
Hi
To define no value labels, you should use NULL, not NA.
Hi again,
No luck after converting them to empty. It gave me the same error. I had no issue to use "set_variable_labels", possibly indicating that it's not the R environmental problem.
Do you have any other suggestion for me to try?
Just a thought, as those variables having NA values in the dataframe are categorical, not numerical so it's technically Not Applicable (NA) rather than NULL (empty).
I'm sorry but I will need a reproductive example to understand what you are doing.
If you are using set_value_labels()
with the .labels
argument, you should pass a named list of named vectors, not a character vector as "0=No,1=Yes"
for example:
list(
id_child = NULL,
sex = c(male = 1, female = 2),
alive = c(`no, dead` = 0, `yes, alive` = 1),
age_at_death = NULL
)
Hello-
I am using your package to write a sav file and set_value_labels is giving me this error: Error:
x
andvalue
must be same typeI used a column from a dataframe where a list has value labels corresponding to the numeric values (integer) and for the character values, value labels are all NAs.
The data looks like this: [1] "0=No,1=Yes" [2] "0=Not Selected,1=Selected" [3] NA ... [456]"0=No,1=Yes"
I would appreciate it if this is a user-error from my end!
Thank you,