{"action":"created","issue":{"url":"https://api.github.com/repos/hadley/haven/issues/120","labels_url":"https://api.github.com/repos/hadley/haven/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/hadley/haven/issues/120/comments","events_url":"https://api.github.com/repos/hadley/haven/issues/120/events","html_url":"https://github.com/hadley/haven/issues/120","id":111713281,"number":120,"title":"as_factor not working with NA:s from SPSS in 0.2.0.9000","user":{"login":"gabrakadabra","id":2210514,"avatar_url":"https://avatars.githubusercontent.com/u/2210514?v=3","gravatar_id":"","url":"https://api.github.com/users/gabrakadabra","html_url":"https://github.com/gabrakadabra","followers_url":"https://api.github.com/users/gabrakadabra/followers","following_url":"https://api.github.com/users/gabrakadabra/following{/other_user}","gists_url":"https://api.github.com/users/gabrakadabra/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrakadabra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrakadabra/subscriptions","organizations_url":"https://api.github.com/users/gabrakadabra/orgs","repos_url":"https://api.github.com/users/gabrakadabra/repos","events_url":"https://api.github.com/users/gabrakadabra/events{/privacy}","received_events_url":"https://api.github.com/users/gabrakadabra/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-15T21:41:58Z","updated_at":"2015-10-23T00:39:51Z","closed_at":null,"body":"Hi. I just installed the devversion of Haven `haven_0.2.0.9000`\r\nand suddenly the `as_factor` fails when importing from SPSS using `read_sav()`,\r\nand the variable contains NA:s\r\n\r\nA fast test shows that \r\n```r\r\nvh = labelled(c(1, 1, 2, 3, 99, NA), c(Car = 1, Bike = 2, Bus = 3, Unknown = 99))\r\nas_factor(vh)\r\n#>[1] Car     Car     Bike    Bus     Unknown <NA>   \r\n#>Levels: Car Bike Bus Unknown\r\n```\r\nworks fine but when I reproduce the data in SPSS I get an error.\r\n```r\r\ndf <- haven::read_sav('test_haven.sav')\r\nas_factor(df$vh)\r\n\r\n#>Error in !attr(x, \"is_na\") : invalid argument type\r\n```\r\n\r\nI did not get the error in 0.2.0 from CRAN, which does not support the Unknown = 99 above."},"comment":{"url":"https://api.github.com/repos/hadley/haven/issues/comments/150395868","html_url":"https://github.com/hadley/haven/issues/120#issuecomment-150395868","issue_url":"https://api.github.com/repos/hadley/haven/issues/120","id":150395868,"user":{"login":"gergness","id":2104579,"avatar_url":"https://avatars.githubusercontent.com/u/2104579?v=3","gravatar_id":"","url":"https://api.github.com/users/gergness","html_url":"https://github.com/gergness","followers_url":"https://api.github.com/users/gergness/followers","following_url":"https://api.github.com/users/gergness/following{/other_user}","gists_url":"https://api.github.com/users/gergness/gists{/gist_id}","starred_url":"https://api.github.com/users/gergness/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gergness/subscriptions","organizations_url":"https://api.github.com/users/gergness/orgs","repos_url":"https://api.github.com/users/gergness/repos","events_url":"https://api.github.com/users/gergness/events{/privacy}","received_events_url":"https://api.github.com/users/gergness/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T00:39:51Z","updated_at":"2015-10-23T00:39:51Z","body":"Strange, doesn't look like it is related to the version of Rcpp or devtools as those are what i have now. Glad you found a solution that works for you -- when I reinstalled haven the problem was fixed for me, and I'm not sure what was different the second time."}}