{"action":"created","issue":{"url":"https://api.github.com/repos/hadley/haven/issues/35","labels_url":"https://api.github.com/repos/hadley/haven/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/hadley/haven/issues/35/comments","events_url":"https://api.github.com/repos/hadley/haven/issues/35/events","html_url":"https://github.com/hadley/haven/issues/35","id":59805118,"number":35,"title":"Error when importing .por datafile (read.spss works)","user":{"login":"jlegewie","id":1292401,"avatar_url":"https://avatars.githubusercontent.com/u/1292401?v=3","gravatar_id":"","url":"https://api.github.com/users/jlegewie","html_url":"https://github.com/jlegewie","followers_url":"https://api.github.com/users/jlegewie/followers","following_url":"https://api.github.com/users/jlegewie/following{/other_user}","gists_url":"https://api.github.com/users/jlegewie/gists{/gist_id}","starred_url":"https://api.github.com/users/jlegewie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlegewie/subscriptions","organizations_url":"https://api.github.com/users/jlegewie/orgs","repos_url":"https://api.github.com/users/jlegewie/repos","events_url":"https://api.github.com/users/jlegewie/events{/privacy}","received_events_url":"https://api.github.com/users/jlegewie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-04T14:31:59Z","updated_at":"2015-03-06T19:06:02Z","closed_at":null,"body":"I am getting this error when I try to open a SPSS por file: \r\n```\r\nError in df_parse_por(clean_path(path)) : \r\nattempt to set index 0/0 in SET_STRING_ELT\r\n```\r\nBelow is code that downloads the file. It works with read.spss.\r\n\r\n\r\n```\r\nlibrary(\"haven\")\r\nlibrary(\"foreign\")\r\n# download and unzip file to temporary folder\r\nurl <- \"http://www.nyc.gov/html/nypd/downloads/zip/analysis_and_planning/2006_sqf.zip\"\r\np1 <- file.path(tempdir(), basename(url))\r\ndownload.file(url, p1, quiet = TRUE)\r\nfilename <- unzip(p1, list = TRUE)$Name[1]\r\nunzip(p1, files = filename, exdir = tempdir())\r\n# open file\r\np2 <- file.path(tempdir(), filename)\r\nDF <- read_por(p2)\r\n# Error in df_parse_por(clean_path(path)) : \r\n#  attempt to set index 0/0 in SET_STRING_ELT\r\nDF <- foreign::read.spss(p2, use.value.labels = FALSE, to.data.frame = TRUE)\r\n```\r\n\r\n**sessionInfo()**\r\n```\r\nR version 3.1.1 (2014-07-10)\r\nPlatform: x86_64-apple-darwin13.4.0 (64-bit)\r\n\r\nlocale:\r\n[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8\r\n\r\nattached base packages:\r\n[1] stats     graphics  grDevices utils     datasets  methods   base     \r\n\r\nother attached packages:\r\n[1] foreign_0.8-62   haven_0.1.1.9000 Defaults_1.1-1  \r\n\r\nloaded via a namespace (and not attached):\r\n[1] Rcpp_0.11.4\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hadley/haven/issues/comments/77616208","html_url":"https://github.com/hadley/haven/issues/35#issuecomment-77616208","issue_url":"https://api.github.com/repos/hadley/haven/issues/35","id":77616208,"user":{"login":"evanmiller","id":134711,"avatar_url":"https://avatars.githubusercontent.com/u/134711?v=3","gravatar_id":"","url":"https://api.github.com/users/evanmiller","html_url":"https://github.com/evanmiller","followers_url":"https://api.github.com/users/evanmiller/followers","following_url":"https://api.github.com/users/evanmiller/following{/other_user}","gists_url":"https://api.github.com/users/evanmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/evanmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evanmiller/subscriptions","organizations_url":"https://api.github.com/users/evanmiller/orgs","repos_url":"https://api.github.com/users/evanmiller/repos","events_url":"https://api.github.com/users/evanmiller/events{/privacy}","received_events_url":"https://api.github.com/users/evanmiller/received_events","type":"User","site_admin":false},"created_at":"2015-03-06T19:06:02Z","updated_at":"2015-03-06T19:06:02Z","body":"@hadley -- a possible culprit is that the POR callbacks are out of order. The info_callback happens at the end of the file, because AFAIK it's not possible to determine the number of records in advance. Forgot about that until just now."}}