{
  "id": 68725,
  "title": "read.csv problem with fullVisitorId",
  "url": "/competitions/ga-customer-revenue-prediction/discussion/68725",
  "author_name": "",
  "post_date": "2018-10-16T13:35:32.177490500Z",
  "votes": null,
  "comment_count": 21,
  "views": 0,
  "content": "<p>when I use \"read.csv(\"train.csv\")\" function in R, </p>\n\n<p>fullVisitorId value is not matched with original value.</p>\n\n<p>ex) fullVisitorId(origina) ≠ fullVisitorId(loaded by read.csv) </p>\n\n<p>I know this problem can be solved by  dtype={'fullVisitorId': 'str'} with Python</p>\n\n<p>But I want to handle this problem through R</p>\n\n<p>Does anyone know the solution of this ?</p>\n\n<p><img src=\"https://postfiles.pstatic.net/MjAxODEwMTdfMjQg/MDAxNTM5NzAyNTY1MTI4.0q-z_U-X7jKpn5cxpiGn7bz-eF5-ItFzR8Mgy5chfb0g.yJ9pYDvqZ6ArcDghtqXW4Ew_0eeAwcVjFlFEmQjCALMg.PNG.dake123/load_problem.png?type=w580\" alt=\"problems\"></p>",
  "messages": [
    {
      "id": "404866",
      "postDate": "10/16/2018 13:35:32",
      "content": "<p>when I use \"read.csv(\"train.csv\")\" function in R, </p>\n\n<p>fullVisitorId value is not matched with original value.</p>\n\n<p>ex) fullVisitorId(origina) ≠ fullVisitorId(loaded by read.csv) </p>\n\n<p>I know this problem can be solved by  dtype={'fullVisitorId': 'str'} with Python</p>\n\n<p>But I want to handle this problem through R</p>\n\n<p>Does anyone know the solution of this ?</p>\n\n<p><img src=\"https://postfiles.pstatic.net/MjAxODEwMTdfMjQg/MDAxNTM5NzAyNTY1MTI4.0q-z_U-X7jKpn5cxpiGn7bz-eF5-ItFzR8Mgy5chfb0g.yJ9pYDvqZ6ArcDghtqXW4Ew_0eeAwcVjFlFEmQjCALMg.PNG.dake123/load_problem.png?type=w580\" alt=\"problems\"></p>",
      "rawMarkdown": "when I use \"read.csv(\"train.csv\")\" function in R, \n\nfullVisitorId value is not matched with original value.\n\nex) fullVisitorId(origina) ≠ fullVisitorId(loaded by read.csv) \n\nI know this problem can be solved by  dtype={'fullVisitorId': 'str'} with Python\n\nBut I want to handle this problem through R\n\nDoes anyone know the solution of this ?\n\n![problems][1]\n\n\n  [1]: https://postfiles.pstatic.net/MjAxODEwMTdfMjQg/MDAxNTM5NzAyNTY1MTI4.0q-z_U-X7jKpn5cxpiGn7bz-eF5-ItFzR8Mgy5chfb0g.yJ9pYDvqZ6ArcDghtqXW4Ew_0eeAwcVjFlFEmQjCALMg.PNG.dake123/load_problem.png?type=w580",
      "votes": null
    },
    {
      "id": "404891",
      "postDate": "10/16/2018 14:19:30",
      "content": "<p>Please look at the kernels and select R as a language - this should get you started - plus you will get the bonus of handling 'json' in an r fashion</p>",
      "rawMarkdown": "Please look at the kernels and select R as a language - this should get you started - plus you will get the bonus of handling 'json' in an r fashion",
      "votes": null
    },
    {
      "id": "404894",
      "postDate": "10/16/2018 14:29:08",
      "content": "<p>When you're dealing with importing DataFrames into R through CSV, columns with string data take the atomic data type 'factor', not of type 'character' (the R version of strings). 'factor' objects are supposed to be categorical whereas 'character' objects are free-form, they are not equivalent objects. In your call to read.csv() you should pass <code>stringsAsFactors=FALSE</code></p>",
      "rawMarkdown": "When you're dealing with importing DataFrames into R through CSV, columns with string data take the atomic data type 'factor', not of type 'character' (the R version of strings). 'factor' objects are supposed to be categorical whereas 'character' objects are free-form, they are not equivalent objects. In your call to read.csv() you should pass `stringsAsFactors=FALSE`",
      "votes": null
    },
    {
      "id": "404906",
      "postDate": "10/16/2018 14:49:46",
      "content": "<p>Thank you for reply, but What I really mean is that\nthe loaded fullVisitorId value is not mached with original fullVisitorId value.\nI uploaded what the problem is.</p>",
      "rawMarkdown": "Thank you for reply, but What I really mean is that\nthe loaded fullVisitorId value is not mached with original fullVisitorId value.\nI uploaded what the problem is.\n\n\n  [1]: https://postfiles.pstatic.net/MjAxODEwMTZfMTg3/MDAxNTM5NzAxMzAzMjUz.wc13kD00N6BU2jYPFF0htv5R7WniyLdV3hLgmluvKMkg.lISNdcBcrTAqwL7aKbx1_qlSF9yVEy0dNnEmoTec02wg.PNG.dake123/load_problem.png?type=w580",
      "votes": null
    },
    {
      "id": "404910",
      "postDate": "10/16/2018 14:53:47",
      "content": "<p>Thank you, but I didn't use stringAsFactors .\nI uploaded the picture of problem. could you check this?</p>",
      "rawMarkdown": "Thank you, but I didn't use stringAsFactors .\nI uploaded the picture of problem. could you check this?",
      "votes": null
    },
    {
      "id": "404931",
      "postDate": "10/16/2018 15:41:01",
      "content": "<h2>options - to prevent some unwanted side effects</h2>\n\n<p>options(stringsAsFactors= FALSE)</p>",
      "rawMarkdown": "## options - to prevent some unwanted side effects\noptions(stringsAsFactors= FALSE)",
      "votes": null
    },
    {
      "id": "404939",
      "postDate": "10/16/2018 15:58:58",
      "content": "<p>thanks for reply... but fullVisitorId is a numeric by nature... so the option \"stingsAsFactors=F\" is not make difference .....  I tried options(stingsAsFactors=FALSE and read.csv(\"train.csv\",stingsAsFactors=F)). But it is no use...</p>\n\n<p>some people suffer from this issue.... but I don't know why this occurs </p>",
      "rawMarkdown": "thanks for reply... but fullVisitorId is a numeric by nature... so the option \"stingsAsFactors=F\" is not make difference .....  I tried options(stingsAsFactors=FALSE and read.csv(\"train.csv\",stingsAsFactors=F)). But it is no use...\n\nsome people suffer from this issue.... but I don't know why this occurs",
      "votes": null
    },
    {
      "id": "404947",
      "postDate": "10/16/2018 16:18:42",
      "content": "<p>No it isn't.  Consider the ids 012 and 0012:\n012 =&gt; 12\n0012 =&gt; 12\nYou don't want to automatically use numbers because you will slice off the zeros! ;)</p>",
      "rawMarkdown": "No it isn't.  Consider the ids 012 and 0012:\n012 =&gt; 12\n0012 =&gt; 12\nYou don't want to automatically use numbers because you will slice off the zeros! ;)",
      "votes": null
    },
    {
      "id": "404951",
      "postDate": "10/16/2018 16:28:39",
      "content": "<p>sorry..... I don't understand what you mean.... cause I am not good at english... </p>\n\n<p>I changed my code like this       read.csv(\"train.csv\",stringsAsFactors=F) </p>\n\n<p>the same problem occurs....</p>\n\n<p>I am so sorry for bothering you....</p>",
      "rawMarkdown": "sorry..... I don't understand what you mean.... cause I am not good at english... \n\nI changed my code like this       read.csv(\"train.csv\",stringsAsFactors=F) \n\nthe same problem occurs....\n\nI am so sorry for bothering you....",
      "votes": null
    },
    {
      "id": "404953",
      "postDate": "10/16/2018 16:34:19",
      "content": "<p>Look at <a href=\"https://www.kaggle.com/captcalculator/a-very-extensive-gstore-exploratory-analysis\">https://www.kaggle.com/captcalculator/a-very-extensive-gstore-exploratory-analysis</a>\nNote that fullVisitorId is chr\nThis is why I asked you to look at existing R kernels</p>\n\n<pre><code>000001 as a number is 1\n00001 as a number is 1\n</code></pre>\n\n<p>As strings these ids will not be the same</p>",
      "rawMarkdown": "Look at https://www.kaggle.com/captcalculator/a-very-extensive-gstore-exploratory-analysis\nNote that fullVisitorId is chr\nThis is why I asked you to look at existing R kernels\n\n    000001 as a number is 1\n    00001 as a number is 1\n\nAs strings these ids will not be the same",
      "votes": null
    },
    {
      "id": "404966",
      "postDate": "10/16/2018 16:58:28",
      "content": "<p>Do you want to explain \"00001\"(string) ≠ 00001(number) ? </p>\n\n<p>I know they are different....</p>\n\n<p>My problem is when I use read.csv to load train.csv, </p>\n\n<p>the first fullVisitorId value(=1131660440785960000) is transfered to \n1131660440785968512 ..... <img src=\"https://postfiles.pstatic.net/MjAxODEwMTdfMjQg/MDAxNTM5NzAyNTY1MTI4.0q-z_U-X7jKpn5cxpiGn7bz-eF5-ItFzR8Mgy5chfb0g.yJ9pYDvqZ6ArcDghtqXW4Ew_0eeAwcVjFlFEmQjCALMg.PNG.dake123/load_problem.png?type=w580\" alt=\"problem\"></p>\n\n<p>that R kernels user use the same function read.csv(\"../train.csv\") like me,</p>\n\n<p>but the user's first fullVisitorId value is mached with original data....</p>\n\n<p>(though the type is character) </p>",
      "rawMarkdown": "Do you want to explain \"00001\"(string) ≠ 00001(number) ? \n\nI know they are different....\n\nMy problem is when I use read.csv to load train.csv, \n\nthe first fullVisitorId value(=1131660440785960000) is transfered to \n1131660440785968512 ..... ![problem][1]\n\n\nthat R kernels user use the same function read.csv(\"../train.csv\") like me,\n\nbut the user's first fullVisitorId value is mached with original data....\n\n(though the type is character) \n\n\n  [1]: https://postfiles.pstatic.net/MjAxODEwMTdfMjQg/MDAxNTM5NzAyNTY1MTI4.0q-z_U-X7jKpn5cxpiGn7bz-eF5-ItFzR8Mgy5chfb0g.yJ9pYDvqZ6ArcDghtqXW4Ew_0eeAwcVjFlFEmQjCALMg.PNG.dake123/load_problem.png?type=w580",
      "votes": null
    },
    {
      "id": "404967",
      "postDate": "10/16/2018 17:08:18",
      "content": "<p>With the deepest respect are you a troll?</p>",
      "rawMarkdown": "With the deepest respect are you a troll?",
      "votes": null
    },
    {
      "id": "404969",
      "postDate": "10/16/2018 17:11:44",
      "content": "<p>The first fullVisitorId is not \"value(=1131660440785960000)\" and also not \"1131660440785968512 ..... problem\".</p>\n\n<p>The first fullVisitorId is 1131660440785968503.</p>\n\n<p>The suggestions from Scirpus to look at kernels with Language R is good and can be supportive ..., most use read_csv and then work on the json part.</p>",
      "rawMarkdown": "The first fullVisitorId is not \"value(=1131660440785960000)\" and also not \"1131660440785968512 ..... problem\".\n\nThe first fullVisitorId is 1131660440785968503.\n\nThe suggestions from Scirpus to look at kernels with Language R is good and can be supportive ..., most use read_csv and then work on the json part.",
      "votes": null
    },
    {
      "id": "404971",
      "postDate": "10/16/2018 17:13:26",
      "content": "<p>sorry... I really don't understand.....</p>\n\n<p>I solved that problem with function read_csv from your R kernel link....</p>\n\n<p>thanks for help</p>",
      "rawMarkdown": "sorry... I really don't understand.....\n\nI solved that problem with function read_csv from your R kernel link....\n\nthanks for help",
      "votes": null
    },
    {
      "id": "404977",
      "postDate": "10/16/2018 17:24:33",
      "content": "<p>Thank goodness for that.</p>\n\n<p>Good luck in the competition.</p>",
      "rawMarkdown": "Thank goodness for that.\n\nGood luck in the competition.",
      "votes": null
    },
    {
      "id": "404980",
      "postDate": "10/16/2018 17:29:59",
      "content": "<p>Thanks :) , I didn't catch the difference of \"read.csv\" and \"read_csv\" because I am newbie ... </p>",
      "rawMarkdown": "Thanks :) , I didn't catch the difference of \"read.csv\" and \"read_csv\" because I am newbie ...",
      "votes": null
    },
    {
      "id": "404988",
      "postDate": "10/16/2018 17:45:41",
      "content": "<p>Using data.table's \"fread\", this is from my notebook:</p>\n\n<pre><code> Classes&lt;- sapply(fread(\"...train.csv\"),class)\n Classes[\"fullVisitorId\"]&lt;-\"character\"\n Data&lt;-fread(\"...train.csv\",colClasses = Classes)\n</code></pre>",
      "rawMarkdown": "Using data.table's \"fread\", this is from my notebook:\n\n     Classes&lt;- sapply(fread(\"...train.csv\"),class)\n     Classes[\"fullVisitorId\"]&lt;-\"character\"\n     Data&lt;-fread(\"...train.csv\",colClasses = Classes)",
      "votes": null
    },
    {
      "id": "404996",
      "postDate": "10/16/2018 17:55:00",
      "content": "<p>thanks for giving me new solution!\nDo you know why read.csv function have problems?\nread_csv and fread are works , but read.csv have problem...</p>",
      "rawMarkdown": "thanks for giving me new solution!\nDo you know why read.csv function have problems?\nread_csv and fread are works , but read.csv have problem...",
      "votes": null
    },
    {
      "id": "406237",
      "postDate": "10/18/2018 22:48:26",
      "content": "<p>I think the link to the picture is broken because I can't get to it. stringAsFactors is set by default to TRUE, even if you don't include it in your code, you need to explicitly turn it off, but by the looks of this discussion, your problem was solved :)</p>",
      "rawMarkdown": "I think the link to the picture is broken because I can't get to it. stringAsFactors is set by default to TRUE, even if you don't include it in your code, you need to explicitly turn it off, but by the looks of this discussion, your problem was solved :)",
      "votes": null
    },
    {
      "id": "406258",
      "postDate": "10/19/2018 00:14:25",
      "content": "<p>thanks ! I solved my problem with read_csv function! </p>",
      "rawMarkdown": "thanks ! I solved my problem with read_csv function!",
      "votes": null
    },
    {
      "id": "406637",
      "postDate": "10/19/2018 14:59:28",
      "content": "<p><code>data &lt;- read.csv('../input/train.csv', colClasses=c(fullVisitorId=\"character\"))</code></p>\n\n<p>You need to specify to read fullVisitorId as a string in read.csv ... i believe both <code>read_csv</code> and <code>fread</code> can accomplish this without you specifying though</p>",
      "rawMarkdown": "`data &lt;- read.csv('../input/train.csv', colClasses=c(fullVisitorId=\"character\"))`\n\nYou need to specify to read fullVisitorId as a string in read.csv ... i believe both `read_csv` and `fread` can accomplish this without you specifying though",
      "votes": null
    },
    {
      "id": "407119",
      "postDate": "10/20/2018 12:19:50",
      "content": "<p>Yes! I found that options important when loading fullVisitorId !!! \nthanks for reply</p>",
      "rawMarkdown": "Yes! I found that options important when loading fullVisitorId !!! \nthanks for reply",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 404891,
      "author_name": "scirpus",
      "author_url": "",
      "post_date": "10/16/2018 14:19:30",
      "content": "<p>Please look at the kernels and select R as a language - this should get you started - plus you will get the bonus of handling 'json' in an r fashion</p>",
      "votes": null,
      "replies": [
        {
          "id": 404906,
          "author_name": "jimeng314",
          "author_url": "",
          "post_date": "10/16/2018 14:49:46",
          "content": "<p>Thank you for reply, but What I really mean is that\nthe loaded fullVisitorId value is not mached with original fullVisitorId value.\nI uploaded what the problem is.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 404894,
      "author_name": "alecthekulak",
      "author_url": "",
      "post_date": "10/16/2018 14:29:08",
      "content": "<p>When you're dealing with importing DataFrames into R through CSV, columns with string data take the atomic data type 'factor', not of type 'character' (the R version of strings). 'factor' objects are supposed to be categorical whereas 'character' objects are free-form, they are not equivalent objects. In your call to read.csv() you should pass <code>stringsAsFactors=FALSE</code></p>",
      "votes": null,
      "replies": [
        {
          "id": 404910,
          "author_name": "jimeng314",
          "author_url": "",
          "post_date": "10/16/2018 14:53:47",
          "content": "<p>Thank you, but I didn't use stringAsFactors .\nI uploaded the picture of problem. could you check this?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 406237,
          "author_name": "alecthekulak",
          "author_url": "",
          "post_date": "10/18/2018 22:48:26",
          "content": "<p>I think the link to the picture is broken because I can't get to it. stringAsFactors is set by default to TRUE, even if you don't include it in your code, you need to explicitly turn it off, but by the looks of this discussion, your problem was solved :)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 406258,
          "author_name": "jimeng314",
          "author_url": "",
          "post_date": "10/19/2018 00:14:25",
          "content": "<p>thanks ! I solved my problem with read_csv function! </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 404931,
      "author_name": "justfor",
      "author_url": "",
      "post_date": "10/16/2018 15:41:01",
      "content": "<h2>options - to prevent some unwanted side effects</h2>\n\n<p>options(stringsAsFactors= FALSE)</p>",
      "votes": null,
      "replies": [
        {
          "id": 404939,
          "author_name": "jimeng314",
          "author_url": "",
          "post_date": "10/16/2018 15:58:58",
          "content": "<p>thanks for reply... but fullVisitorId is a numeric by nature... so the option \"stingsAsFactors=F\" is not make difference .....  I tried options(stingsAsFactors=FALSE and read.csv(\"train.csv\",stingsAsFactors=F)). But it is no use...</p>\n\n<p>some people suffer from this issue.... but I don't know why this occurs </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 404947,
          "author_name": "scirpus",
          "author_url": "",
          "post_date": "10/16/2018 16:18:42",
          "content": "<p>No it isn't.  Consider the ids 012 and 0012:\n012 =&gt; 12\n0012 =&gt; 12\nYou don't want to automatically use numbers because you will slice off the zeros! ;)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 404951,
          "author_name": "jimeng314",
          "author_url": "",
          "post_date": "10/16/2018 16:28:39",
          "content": "<p>sorry..... I don't understand what you mean.... cause I am not good at english... </p>\n\n<p>I changed my code like this       read.csv(\"train.csv\",stringsAsFactors=F) </p>\n\n<p>the same problem occurs....</p>\n\n<p>I am so sorry for bothering you....</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 404953,
          "author_name": "scirpus",
          "author_url": "",
          "post_date": "10/16/2018 16:34:19",
          "content": "<p>Look at <a href=\"https://www.kaggle.com/captcalculator/a-very-extensive-gstore-exploratory-analysis\">https://www.kaggle.com/captcalculator/a-very-extensive-gstore-exploratory-analysis</a>\nNote that fullVisitorId is chr\nThis is why I asked you to look at existing R kernels</p>\n\n<pre><code>000001 as a number is 1\n00001 as a number is 1\n</code></pre>\n\n<p>As strings these ids will not be the same</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 404966,
          "author_name": "jimeng314",
          "author_url": "",
          "post_date": "10/16/2018 16:58:28",
          "content": "<p>Do you want to explain \"00001\"(string) ≠ 00001(number) ? </p>\n\n<p>I know they are different....</p>\n\n<p>My problem is when I use read.csv to load train.csv, </p>\n\n<p>the first fullVisitorId value(=1131660440785960000) is transfered to \n1131660440785968512 ..... <img src=\"https://postfiles.pstatic.net/MjAxODEwMTdfMjQg/MDAxNTM5NzAyNTY1MTI4.0q-z_U-X7jKpn5cxpiGn7bz-eF5-ItFzR8Mgy5chfb0g.yJ9pYDvqZ6ArcDghtqXW4Ew_0eeAwcVjFlFEmQjCALMg.PNG.dake123/load_problem.png?type=w580\" alt=\"problem\"></p>\n\n<p>that R kernels user use the same function read.csv(\"../train.csv\") like me,</p>\n\n<p>but the user's first fullVisitorId value is mached with original data....</p>\n\n<p>(though the type is character) </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 404967,
          "author_name": "scirpus",
          "author_url": "",
          "post_date": "10/16/2018 17:08:18",
          "content": "<p>With the deepest respect are you a troll?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 404971,
          "author_name": "jimeng314",
          "author_url": "",
          "post_date": "10/16/2018 17:13:26",
          "content": "<p>sorry... I really don't understand.....</p>\n\n<p>I solved that problem with function read_csv from your R kernel link....</p>\n\n<p>thanks for help</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 404977,
          "author_name": "scirpus",
          "author_url": "",
          "post_date": "10/16/2018 17:24:33",
          "content": "<p>Thank goodness for that.</p>\n\n<p>Good luck in the competition.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 404969,
      "author_name": "justfor",
      "author_url": "",
      "post_date": "10/16/2018 17:11:44",
      "content": "<p>The first fullVisitorId is not \"value(=1131660440785960000)\" and also not \"1131660440785968512 ..... problem\".</p>\n\n<p>The first fullVisitorId is 1131660440785968503.</p>\n\n<p>The suggestions from Scirpus to look at kernels with Language R is good and can be supportive ..., most use read_csv and then work on the json part.</p>",
      "votes": null,
      "replies": [
        {
          "id": 404980,
          "author_name": "jimeng314",
          "author_url": "",
          "post_date": "10/16/2018 17:29:59",
          "content": "<p>Thanks :) , I didn't catch the difference of \"read.csv\" and \"read_csv\" because I am newbie ... </p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 404988,
      "author_name": "tpthegreat",
      "author_url": "",
      "post_date": "10/16/2018 17:45:41",
      "content": "<p>Using data.table's \"fread\", this is from my notebook:</p>\n\n<pre><code> Classes&lt;- sapply(fread(\"...train.csv\"),class)\n Classes[\"fullVisitorId\"]&lt;-\"character\"\n Data&lt;-fread(\"...train.csv\",colClasses = Classes)\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 404996,
          "author_name": "jimeng314",
          "author_url": "",
          "post_date": "10/16/2018 17:55:00",
          "content": "<p>thanks for giving me new solution!\nDo you know why read.csv function have problems?\nread_csv and fread are works , but read.csv have problem...</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 406637,
          "author_name": "returnofsputnik",
          "author_url": "",
          "post_date": "10/19/2018 14:59:28",
          "content": "<p><code>data &lt;- read.csv('../input/train.csv', colClasses=c(fullVisitorId=\"character\"))</code></p>\n\n<p>You need to specify to read fullVisitorId as a string in read.csv ... i believe both <code>read_csv</code> and <code>fread</code> can accomplish this without you specifying though</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 407119,
          "author_name": "jimeng314",
          "author_url": "",
          "post_date": "10/20/2018 12:19:50",
          "content": "<p>Yes! I found that options important when loading fullVisitorId !!! \nthanks for reply</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "404866": "when I use \"read.csv(\"train.csv\")\" function in R, \n\nfullVisitorId value is not matched with original value.\n\nex) fullVisitorId(origina) ≠ fullVisitorId(loaded by read.csv) \n\nI know this problem can be solved by  dtype={'fullVisitorId': 'str'} with Python\n\nBut I want to handle this problem through R\n\nDoes anyone know the solution of this ?\n\n![problems][1]\n\n\n  [1]: https://postfiles.pstatic.net/MjAxODEwMTdfMjQg/MDAxNTM5NzAyNTY1MTI4.0q-z_U-X7jKpn5cxpiGn7bz-eF5-ItFzR8Mgy5chfb0g.yJ9pYDvqZ6ArcDghtqXW4Ew_0eeAwcVjFlFEmQjCALMg.PNG.dake123/load_problem.png?type=w580",
    "404891": "Please look at the kernels and select R as a language - this should get you started - plus you will get the bonus of handling 'json' in an r fashion",
    "404894": "When you're dealing with importing DataFrames into R through CSV, columns with string data take the atomic data type 'factor', not of type 'character' (the R version of strings). 'factor' objects are supposed to be categorical whereas 'character' objects are free-form, they are not equivalent objects. In your call to read.csv() you should pass `stringsAsFactors=FALSE`",
    "404906": "Thank you for reply, but What I really mean is that\nthe loaded fullVisitorId value is not mached with original fullVisitorId value.\nI uploaded what the problem is.\n\n\n  [1]: https://postfiles.pstatic.net/MjAxODEwMTZfMTg3/MDAxNTM5NzAxMzAzMjUz.wc13kD00N6BU2jYPFF0htv5R7WniyLdV3hLgmluvKMkg.lISNdcBcrTAqwL7aKbx1_qlSF9yVEy0dNnEmoTec02wg.PNG.dake123/load_problem.png?type=w580",
    "404910": "Thank you, but I didn't use stringAsFactors .\nI uploaded the picture of problem. could you check this?",
    "404931": "## options - to prevent some unwanted side effects\noptions(stringsAsFactors= FALSE)",
    "404939": "thanks for reply... but fullVisitorId is a numeric by nature... so the option \"stingsAsFactors=F\" is not make difference .....  I tried options(stingsAsFactors=FALSE and read.csv(\"train.csv\",stingsAsFactors=F)). But it is no use...\n\nsome people suffer from this issue.... but I don't know why this occurs",
    "404947": "No it isn't.  Consider the ids 012 and 0012:\n012 =&gt; 12\n0012 =&gt; 12\nYou don't want to automatically use numbers because you will slice off the zeros! ;)",
    "404951": "sorry..... I don't understand what you mean.... cause I am not good at english... \n\nI changed my code like this       read.csv(\"train.csv\",stringsAsFactors=F) \n\nthe same problem occurs....\n\nI am so sorry for bothering you....",
    "404953": "Look at https://www.kaggle.com/captcalculator/a-very-extensive-gstore-exploratory-analysis\nNote that fullVisitorId is chr\nThis is why I asked you to look at existing R kernels\n\n    000001 as a number is 1\n    00001 as a number is 1\n\nAs strings these ids will not be the same",
    "404966": "Do you want to explain \"00001\"(string) ≠ 00001(number) ? \n\nI know they are different....\n\nMy problem is when I use read.csv to load train.csv, \n\nthe first fullVisitorId value(=1131660440785960000) is transfered to \n1131660440785968512 ..... ![problem][1]\n\n\nthat R kernels user use the same function read.csv(\"../train.csv\") like me,\n\nbut the user's first fullVisitorId value is mached with original data....\n\n(though the type is character) \n\n\n  [1]: https://postfiles.pstatic.net/MjAxODEwMTdfMjQg/MDAxNTM5NzAyNTY1MTI4.0q-z_U-X7jKpn5cxpiGn7bz-eF5-ItFzR8Mgy5chfb0g.yJ9pYDvqZ6ArcDghtqXW4Ew_0eeAwcVjFlFEmQjCALMg.PNG.dake123/load_problem.png?type=w580",
    "404967": "With the deepest respect are you a troll?",
    "404969": "The first fullVisitorId is not \"value(=1131660440785960000)\" and also not \"1131660440785968512 ..... problem\".\n\nThe first fullVisitorId is 1131660440785968503.\n\nThe suggestions from Scirpus to look at kernels with Language R is good and can be supportive ..., most use read_csv and then work on the json part.",
    "404971": "sorry... I really don't understand.....\n\nI solved that problem with function read_csv from your R kernel link....\n\nthanks for help",
    "404977": "Thank goodness for that.\n\nGood luck in the competition.",
    "404980": "Thanks :) , I didn't catch the difference of \"read.csv\" and \"read_csv\" because I am newbie ...",
    "404988": "Using data.table's \"fread\", this is from my notebook:\n\n     Classes&lt;- sapply(fread(\"...train.csv\"),class)\n     Classes[\"fullVisitorId\"]&lt;-\"character\"\n     Data&lt;-fread(\"...train.csv\",colClasses = Classes)",
    "404996": "thanks for giving me new solution!\nDo you know why read.csv function have problems?\nread_csv and fread are works , but read.csv have problem...",
    "406237": "I think the link to the picture is broken because I can't get to it. stringAsFactors is set by default to TRUE, even if you don't include it in your code, you need to explicitly turn it off, but by the looks of this discussion, your problem was solved :)",
    "406258": "thanks ! I solved my problem with read_csv function!",
    "406637": "`data &lt;- read.csv('../input/train.csv', colClasses=c(fullVisitorId=\"character\"))`\n\nYou need to specify to read fullVisitorId as a string in read.csv ... i believe both `read_csv` and `fread` can accomplish this without you specifying though",
    "407119": "Yes! I found that options important when loading fullVisitorId !!! \nthanks for reply"
  },
  "source": "meta"
}