6

My student and I both loaded the same dataset, installed the same packages, and were running the same code. When I run "frq" I get a frequency table and the variable is labeled as "numeric." When my student runs the same code, she gets "Error: Can't convert <haven_labelled> to character."

Any thoughts on where we might be going wrong?

Helix123
  • 3,502
  • 2
  • 16
  • 36
mt646
  • 61
  • 1
  • 2

2 Answers2

8

I got same problem. I used library(tidyverse) and it helps.

Gegh
  • 89
  • 1
2

I could say it with more certainty if you had provided an Minimal, Reproducible Example (MWE).

However, borrowing from this answer, the error that you get is most probably because the variable in question is of the type haven_labelled, which not all R functions can deal with.

You should, in principle, be able to solve the issue by changing the variable type to R-friendly factor using haven::as_factor.

psyguy
  • 312
  • 3
  • 16