in R, read_spss() was working perfectly for importing a data set, but I just transferred all of the code over to my new MacBook, and now none of the code works -- it all generates this error message: Error: Can't combine ..1 and ..2 .

Does anyone know why the same code that worked on my old computer wouldn't work on my new one, and how to get read_spss() to work the way it had been for me?

I'm especially confused, because my initial guess was that the different columns were imported as different data classifications, but arithmetic even within one column does not work. Thanks!

SurveyState1979 <- read_spss("07856-0001-Data.por")

table(SurveyState1979$V502) # works fine
sum(is.na(SurveyState1979$V502)) # works fine

#This type of code does not work:
Percentage_of_prisoners_no_job_1979 <- (length(na.omit(SurveyState1979$V502[SurveyState1979$V502 == "1"])))/(length(na.omit(SurveyState1979$V502))) * 100
Percentage_of_prisoners_no_job_1979

When I run rlang::last_error(), I get this:

<error/vctrs_error_incompatible_type> Can't combine ..1 and ..2 . Backtrace:

  1. stats::na.omit(SurveyState1979$V502[SurveyState1979$V502 == "1"])
  2. vctrs:::==.vctrs_vctr(SurveyState1979$V502, "1")
  3. vctrs::vec_equal(e1, e2)
  4. vctrs:::vec_cast_common_params(!!!args, .to = .ptype, .df_fallback = DF_FALLBACK_quiet)
  5. vctrs:::vec_cast_common_opts(..., .to = .to, .opts = opts)
  6. haven:::vec_ptype2.haven_labelled.character(...)
  7. vctrs::vec_ptype2(y, x, ...)
  8. haven:::vec_ptype2.character.haven_labelled(...)
  9. vctrs::vec_ptype2(x, vec_data(y), ...)
  10. vctrs::vec_default_ptype2(...)
  11. vctrs::stop_incompatible_type(...)
  12. vctrs:::stop_incompatible(...)
  13. vctrs:::stop_vctrs(...)

And, the same importing that I did for dta and rda files have worked perfectly.

0

There are 0 best solutions below