Closed psycaroly closed 6 years ago
Can you check whether you also get the error from simply calling skimr::skim_to_wide(data)
on your data? Try both before and after calling
skimr::skim_with(labelled = skimr::get_skimmers()$factor,
labelled_spss = skimr::get_skimmers()$factor)
If you can narrow it down to the variable causing the problem, I'd appreciate a minimal reproducible example (e.g. using the reprex package), but I know these can be hard to generate.
skimr::skim_to_wide(data)
works fine (it just throws two warnings which are irrelevant I guess)
Warning messages:
1: In min(characters, na.rm = TRUE) :
no non-missing arguments to min; returning Inf
2: In max(characters, na.rm = TRUE) :
no non-missing arguments to max; returning -Inf
(it also works after running your code)
Ok cool! Would be great if you can narrow it down a little to what variable causes it. By setting opts_chunk$set(error=TRUE)
in the chunk before you call codebook, you should see which variable causes the bug.
Hi Ruben,
somehow the opts_chunk$set(error=TRUE)
doesn't produce any difference in the output I get (I still get the same error but no info about which variable is responsible). I'll try to identify the problematic variable manually, but if you have any other tip how to identify it not manually I'd appreciate it!
Okay, I found the culprit. I'll try to make a reproducible example.
Maybe dput(yourdata$culprit)
on the variable would be enough for me to reproduce.
Hi Ruben,
sorry, I didn't have time yet to make a reproducible example (perhaps next week). The variable that causes the problem is from a multiple choice question.
In the meantime here's the output from the dput command:
c("6, 7, 14, 15", "6, 13, 14", "6", "6, 14", "12", "6, 16", "6, 13",
"10", "6, 14, 15", "10", "6, 13", "10", "12", "6, 12", "6, 13",
"10", "10", "11", "1", "6, 7, 13", "9, 10", "10", "11, 14", "12",
"10", "6, 14", "6, 13", "10", "6, 13, 14", "11", "10", "11",
"2, 14", "6", "3, 10", "6, 22", "19", "6, 13", "10", "6, 14",
"1", "3", "8, 10", "12", "12", "10", "6, 14", "6, 15", "10",
"6", "6, 14", "2, 3, 6, 10", "11, 12", "6, 11", "6, 10", "10",
"6", "6", "3", "10, 11", "6, 14", "10", "10", "6, 10", "10",
"6", "6, 14", "11, 12", "10", "12", "19", "10", "6, 13, 14, 15",
"6, 14", "3", "17", "6", "8, 12, 16", "6, 13", "6", "6, 12",
"12", "17", "6, 22", "10", "6, 15", "6", "4, 19", "12, 20", "12, 20",
"6, 16", "10", "6, 22", "10", "10", "10", "11, 12", "10", "6, 10, 16",
"10", "11, 12", "10", "10, 11", "17, 20", "11", "10", "6, 14",
"6, 14", "6, 12, 15", "4, 10", "10", "10", "11", "19", "10",
"10", "6, 22", "6, 10, 11", "10", "3, 6, 16", "6, 12", "12",
"6, 13", "10", "10", "11, 12", "12", "10", "6, 14", "6", "10",
"12, 17, 20", "6, 12", "6, 10", "6, 12", "17", "17", "6, 11",
"10", "10", "10", "17", "10", "10", "12", "3, 19", "12", "10",
"10", "12, 13, 14", "6, 15, 22", "10", "10", "11", "6, 10", "10",
"10", "6", "6", "10", "2", "8, 10, 11", "10", "6", "10", "12",
"6, 12", "6, 14", "10", "12, 20", "10", "10", "6, 17", "10, 11, 14",
"17", "12, 20", "17", "10", "10", "11, 21", "1, 14", "12", "12",
"10", "11", "10", "12", "17", "10", "6, 14", "10", "1", "10, 11",
"10", "17", "10", "6, 12", "3, 10", "12", "11", "11", "11", "6, 14",
"11", "11", "3", "6", "22", "12", "11", "10", "10", "6", "16",
"19", "10", "21", "21", "10", "1, 14", "10, 11", "11", "6, 10",
"12, 20", "10", "10", "8, 10", "17, 19, 20", "10, 14", "10",
"10", "6, 13", "1, 3, 10", "17", "6, 14, 22", "10", "4", "4, 10",
"10", "10", "6, 15", "1, 12", "15", "6, 10", "6, 10", "10", "10",
"10", "10", "6, 15", "6", "13", "10", "10", "12", "10", "10",
"9, 10", "6, 10", "6, 14", "6", "11, 15, 19", "", "10", "10",
"14, 22", "10, 11", "12", "10", "10", "12, 20", "10", "6, 10",
"10", "6, 10", "6, 14", "6, 12", "10", "10", "10", "7", "6, 19",
"10", "10", "10", "11", "10", "12", "10", "3", "6, 12, 16", "2",
"6, 13, 14", "11, 12", "6, 12", "10", "10", "17", "12", "19",
"19", "3, 13", "10", "12", "10")
Using this as an input for the function codebook_component_single_item
doesn't throw the error. Do you have skimr 1.0.2? Can you paste your sessionInfo()?
You got it! I had skimr 1.0.1., after updating to 1.0.2. it works. Thank you!
Wonderful!
Hi Ruben,
when I use codebook() on my formr data I get the following error:
This seems to be a problem with factors with no label (which should be read as strings instead?), but I can't figure out why / which variables are affected / how to approach this issue.