{"action":"closed","issue":{"url":"https://api.github.com/repos/hadley/readr/issues/298","repository_url":"https://api.github.com/repos/hadley/readr","labels_url":"https://api.github.com/repos/hadley/readr/issues/298/labels{/name}","comments_url":"https://api.github.com/repos/hadley/readr/issues/298/comments","events_url":"https://api.github.com/repos/hadley/readr/issues/298/events","html_url":"https://github.com/hadley/readr/issues/298","id":112885597,"number":298,"title":"Column detection specification problem in read_fwf","user":{"login":"adamdsmith","id":3195855,"avatar_url":"https://avatars.githubusercontent.com/u/3195855?v=3","gravatar_id":"","url":"https://api.github.com/users/adamdsmith","html_url":"https://github.com/adamdsmith","followers_url":"https://api.github.com/users/adamdsmith/followers","following_url":"https://api.github.com/users/adamdsmith/following{/other_user}","gists_url":"https://api.github.com/users/adamdsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/adamdsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamdsmith/subscriptions","organizations_url":"https://api.github.com/users/adamdsmith/orgs","repos_url":"https://api.github.com/users/adamdsmith/repos","events_url":"https://api.github.com/users/adamdsmith/events{/privacy}","received_events_url":"https://api.github.com/users/adamdsmith/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-22T20:31:54Z","updated_at":"2016-06-02T11:49:10Z","closed_at":"2016-06-02T11:49:10Z","body":"Since 0.2.0, `read_fwf` is having trouble parsing some text files that it previously (0.1.1) handled without any problem.\r\n\r\nFor example:\r\n```\r\ntext <- \"F Latitude   Longitude   Alt(m)   Date       Time     S\\r\\nT N37.6 W089.0    201.1 1969-12-31 20:54:04 1\\r\\nT N37.6 W089.0    201.1 1969-12-31 20:54:05 0\\r\\n\"\r\n\r\ncol_pos <- fwf_empty(text, skip = 1)\r\n```\r\n\r\nAs expected, there are seven columns.\r\n\r\n```\r\ncol_pos         \r\n$begin\r\n[1]  0  2  8 18 24 35 44\r\n\r\n$end\r\n[1]  1  7 14 23 34 43 45\r\n\r\n$col_names\r\n[1] \"X1\" \"X2\" \"X3\" \"X4\" \"X5\" \"X6\" \"X7\"\r\n```\r\n\r\n`read_fwf` works with readr 0.1.1:\r\n```\r\nworks <- read_fwf(text, col_pos, col_types = \"_ccncc_\", skip = 1)\r\nworks\r\n     X2     X3    X4         X5       X6\r\n1 N37.6 W089.0 201.1 1969-12-31 20:54:04\r\n2 N37.6 W089.0 201.1 1969-12-31 20:54:05\r\n```\r\n\r\n`read_fwf` has parsing issues in readr 0.2.0 through 0.2.2.  In this case it\r\ntacks on an extra column of `NA`s: \r\n```\r\ndoesnt <- read_fwf(text, col_pos, col_types = \"_ccncc_\", skip = 1)\r\n\r\nWarning: 2 parsing failures.\r\nrow col  expected    actual\r\n1  -- 8 columns 7 columns\r\n2  -- 8 columns 7 columns\r\nWarning message:\r\n    Insufficient `col_types`. Guessing 2 columns.\r\n\r\ndoesnt\r\n     X2     X3    X4         X5       X6   NA\r\n1 N37.6 W089.0 201.1 1969-12-31 20:54:04 <NA>\r\n2 N37.6 W089.0 201.1 1969-12-31 20:54:05 <NA> \r\n```"}}
{"actor":{"display_login":"hadley"}}