0

I am reading in data from an SPSS .sav file on R (I do not have access to the CSV or XLSX file). I am trying to do analyses with mirt. However, the data type is "list", and I cannot get it to change to "integer" or "numeric". There is one column with text and the rest are 0s and 1s. However, I have tried this on a subset of the data which contains only 0s and 1s and have had the same issue. I get this error message when I read in the data:

Warning messages: 1: Values in accuracy are not uniquely identified; output will contain list-cols.

I have tried the as.data.frame command, the data.frame command, and the as.numeric command, but every time I call "typeof" it still tells me "list".

Can anyone tell me how to convert these data to integer or numeric? Thanks in advance!

EDIT: 1 Here is an image of the data.

And the structure from the "dput" call: structure(list(Username = c("lga_tso19", "lga_tso2", "lga_tso20", "lga_tso21", "lga_tso22", "lga_tso24", "lga_tso26", "lga_tso27" ), NEO_C_Q01 = structure(c(5, 3, 4, 4, 5, 4, 5, 5), label = "Always prepared", labels = c(Very inaccurate = 1, Moderately inaccurate = 2, Neither accurate nor inaccurate = 3, Moderately accurate = 4, Very accurate = 5), class = "haven_labelled"), structure(list(77 = list(structure(0, label = "User Respond Correctly?", labels = c(No = 0, Yes = 1), class = "haven_labelled"), structure(1, label = "User Respond Correctly?", labels = c(No = 0, Yes = 1), class = "haven_labelled"), structure(0, label = "User Respond Correctly?", labels = c(No = 0, Yes = 1), class = "haven_labelled"), structure(0, label = "User Respond Correctly?", labels = c(No = 0, Yes = 1), class = "haven_labelled"))

So far, I have attempted unlist(data), as.data.frame(data), data.frame(data), and write.csv(data). When I do unlist() and then typeof() it changes the data to "double", and when I try to run the following on a subset of this data: 2PL<-mirt(baggage, "2PL")

I get this message:

Error in model$x[i, "Type"] : subscript out of bounds In addition: Warning message: In cbind(model$x, OptionalGroups = "") : number of rows of result is not a multiple of vector length (arg 2)

RileyH
  • 1
  • 1
  • try `unlist(your_list)` – cephalopod Mar 30 '20 at 23:57
  • 4
    It might be difficult (for some of us, at least) to help if we don't know what the object looks like. Please make this question *reproducible*. This includes sample code you've attempted (including listing non-base R packages, and any errors/warnings received), sample *unambiguous* data (e.g., `dput(head(x))` or `data.frame(x=...,y=...)`), and intended output. Refs: https://stackoverflow.com/questions/5963269, [mcve], and https://stackoverflow.com/tags/r/info. – r2evans Mar 31 '20 at 00:05
  • Hi @RileyH, Can you please add a snapshot of your data. It'll be more easier to help you. – Shivam Sarin Mar 31 '20 at 14:35
  • Thank you everyone for the help! I have added some more details that should make my question more clear. – RileyH Mar 31 '20 at 16:39

0 Answers0