{"action":"created","issue":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/1601","repository_url":"https://api.github.com/repos/Rdatatable/data.table","labels_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1601/labels{/name}","comments_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1601/comments","events_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1601/events","html_url":"https://github.com/Rdatatable/data.table/issues/1601","id":141988116,"number":1601,"title":"fread changing values","user":{"login":"theladyhat","id":9040721,"avatar_url":"https://avatars.githubusercontent.com/u/9040721?v=3","gravatar_id":"","url":"https://api.github.com/users/theladyhat","html_url":"https://github.com/theladyhat","followers_url":"https://api.github.com/users/theladyhat/followers","following_url":"https://api.github.com/users/theladyhat/following{/other_user}","gists_url":"https://api.github.com/users/theladyhat/gists{/gist_id}","starred_url":"https://api.github.com/users/theladyhat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theladyhat/subscriptions","organizations_url":"https://api.github.com/users/theladyhat/orgs","repos_url":"https://api.github.com/users/theladyhat/repos","events_url":"https://api.github.com/users/theladyhat/events{/privacy}","received_events_url":"https://api.github.com/users/theladyhat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-18T21:56:55Z","updated_at":"2016-03-18T22:01:48Z","closed_at":null,"body":"As the same issue previously posted was promptly closed (without a fix), here is the same issue with an minimal reproducible example. [previous same issue](https://github.com/Rdatatable/data.table/issues/1600)\r\n\r\n## Problem\r\nWhen reading in a dataset, I've come across the famous warning message about \"bumping\" columns to type character. In some cases, this results in the values in the column getting converted to something else. \r\n\r\nThe warning pops up and says that column two has been bumped to type character. When we look at the resulting data.table object read in, the first portion of the column has been changed from T's to numeric 1's instead. \r\n\r\nI get these warnings all the time for different datasets, and I'm scared to think about what data has been changed by using fread. (note the previous issue was run under Apple but the issue is the same regardless)\r\n\r\nI've include code for fread() as well as read.csv(). Read.csv() produces the correct output while fread does not. \r\n\r\n## Session Information\r\n`> sessionInfo()\r\nR version 3.2.2 (2015-08-14)\r\nPlatform: x86_64-w64-mingw32/x64 (64-bit)\r\nRunning under: Windows 7 x64 (build 7601) Service Pack 1\r\n\r\nlocale:\r\n[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252\r\n[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    \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] data.table_1.9.6\r\n\r\nloaded via a namespace (and not attached):\r\n[1] tools_3.2.2  chron_2.3-47`\r\n\r\n## Dataset\r\n[MRE_data_table_issue.txt](https://github.com/Rdatatable/data.table/files/180435/MRE_data_table_issue.txt)\r\n\r\n## Code\r\n`> library(data.table)\r\n> \r\n> setwd(\"~/\")\r\n> dat <- fread(\"MRE_data_table_issue.csv\")\r\nWarning message:\r\nIn fread(\"MRE_data_table_issue.csv\") :\r\n  Bumped column 2 to type character on data row 9, field contains 'C'. Coercing previously read values in this column from logical, integer or numeric back to character which may not be lossless; e.g., if '00' and '000' occurred before they will now be just '0', and there may be inconsistencies with treatment of ',,' and ',NA,' too (if they occurred in this column before the bump). If this matters please rerun and set 'colClasses' to 'character' for this column. Please note that column type detection uses the first 5 rows, the middle 5 rows and the last 5 rows, so hopefully this message should be very rare. If reporting to datatable-help, please rerun and include the output from verbose=TRUE.\r\n> dat\r\n    Run label\r\n 1:   2     1\r\n 2:   3     1\r\n 3:   4     1\r\n 4:   5     1\r\n 5:   6     1\r\n 6:   7     1\r\n 7:   9     1\r\n 8:  10     1\r\n 9:   1     C\r\n10:   8     C\r\n11:  11     T\r\n12:  12     T\r\n13:  13     T\r\n14:  14     T\r\n15:  15     T\r\n16:  16     T\r\n17:  17     T\r\n18:  18     T\r\n19:  20     T\r\n20:  21     T\r\n21:  22     T\r\n22:  23     T\r\n23:  25     T\r\n24:  19     C\r\n25:  24     C\r\n26:  32     C\r\n27:  26     T\r\n28:  27     T\r\n29:  28     T\r\n30:  29     T\r\n31:  30     T\r\n32:  31     T\r\n33:  33     T\r\n34:  34     T\r\n35:  35     T\r\n36:  36     T\r\n37:  37     T\r\n38:  38     T\r\n39:  39     T\r\n    Run label\r\n> real_dat <- read.csv(\"MRE_data_table_issue.csv\")\r\n> real_dat\r\n   Run label\r\n1    2     T\r\n2    3     T\r\n3    4     T\r\n4    5     T\r\n5    6     T\r\n6    7     T\r\n7    9     T\r\n8   10     T\r\n9    1     C\r\n10   8     C\r\n11  11     T\r\n12  12     T\r\n13  13     T\r\n14  14     T\r\n15  15     T\r\n16  16     T\r\n17  17     T\r\n18  18     T\r\n19  20     T\r\n20  21     T\r\n21  22     T\r\n22  23     T\r\n23  25     T\r\n24  19     C\r\n25  24     C\r\n26  32     C\r\n27  26     T\r\n28  27     T\r\n29  28     T\r\n30  29     T\r\n31  30     T\r\n32  31     T\r\n33  33     T\r\n34  34     T\r\n35  35     T\r\n36  36     T\r\n37  37     T\r\n38  38     T\r\n39  39     T`"},"comment":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/comments/198561173","html_url":"https://github.com/Rdatatable/data.table/issues/1601#issuecomment-198561173","issue_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1601","id":198561173,"user":{"login":"arunsrinivasan","id":3102045,"avatar_url":"https://avatars.githubusercontent.com/u/3102045?v=3","gravatar_id":"","url":"https://api.github.com/users/arunsrinivasan","html_url":"https://github.com/arunsrinivasan","followers_url":"https://api.github.com/users/arunsrinivasan/followers","following_url":"https://api.github.com/users/arunsrinivasan/following{/other_user}","gists_url":"https://api.github.com/users/arunsrinivasan/gists{/gist_id}","starred_url":"https://api.github.com/users/arunsrinivasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunsrinivasan/subscriptions","organizations_url":"https://api.github.com/users/arunsrinivasan/orgs","repos_url":"https://api.github.com/users/arunsrinivasan/repos","events_url":"https://api.github.com/users/arunsrinivasan/events{/privacy}","received_events_url":"https://api.github.com/users/arunsrinivasan/received_events","type":"User","site_admin":false},"created_at":"2016-03-18T22:01:48Z","updated_at":"2016-03-18T22:01:48Z","body":"Thanks. The issue seems to be that `T/F` in `fread` is recognised to be logical `TRUE/FALSE`. Providing colClasses works fine.\r\n\r\n```r\r\nrequire(data.table)\r\nfread(\"~/Downloads/MRE_data_table_issue.txt\", colClasses=c(\"integer\", \"character\"))\r\n```\r\n"}}