{
  "id": 20616,
  "title": "best way to create the submission file in R",
  "url": "/competitions/expedia-hotel-recommendations/discussion/20616",
  "author_name": "",
  "post_date": "2016-05-02T09:21:04.263Z",
  "votes": null,
  "comment_count": 3,
  "views": 736,
  "content": "<p>Hi guys, </p>\n\n<p>I am a newbie to kaggle and R and I am stuck trying to create the submission file. what would you recommend is the best way to write the file? </p>\n\n<p>I have a data.frame (or data.table) file of 2528243 rows and 2 columns in the workspace and would like to save it as a csv? </p>\n\n<p>(Aside: is it efficient to assign the values of the top5 hotel clusters as a list to the 2nd column of data.frame? )</p>\n\n<p>I am open to alternate suggestions</p>\n\n<p>Thanks\nSajni</p>",
  "messages": [
    {
      "id": "117984",
      "postDate": "05/02/2016 09:21:04",
      "content": "<p>Hi guys, </p>\n\n<p>I am a newbie to kaggle and R and I am stuck trying to create the submission file. what would you recommend is the best way to write the file? </p>\n\n<p>I have a data.frame (or data.table) file of 2528243 rows and 2 columns in the workspace and would like to save it as a csv? </p>\n\n<p>(Aside: is it efficient to assign the values of the top5 hotel clusters as a list to the 2nd column of data.frame? )</p>\n\n<p>I am open to alternate suggestions</p>\n\n<p>Thanks\nSajni</p>",
      "rawMarkdown": "Hi guys, \r\n\r\nI am a newbie to kaggle and R and I am stuck trying to create the submission file. what would you recommend is the best way to write the file? \r\n\r\nI have a data.frame (or data.table) file of 2528243 rows and 2 columns in the workspace and would like to save it as a csv? \r\n\r\n(Aside: is it efficient to assign the values of the top5 hotel clusters as a list to the 2nd column of data.frame? )\r\n\r\nI am open to alternate suggestions\r\n\r\n\r\nThanks\r\nSajni",
      "votes": null
    },
    {
      "id": "117987",
      "postDate": "05/02/2016 09:46:11",
      "content": "<p>Hi Sajni,</p>\n\n<p>Easy way:</p>\n\n<p><strong>write.csv(dataframe, file='submission.csv', row.names=FALSE)</strong></p>\n\n<p><em>dataframe</em> is your data and <em>submission.csv</em> will be the file to submit.</p>\n\n<p><em>dateframe</em> variable names must be <em>id</em> and <em>hotel_cluster</em> . You can use: </p>\n\n<p><strong>setnames(dataframe, c(&quot;id&quot;, &quot;hotel_cluster&quot;))</strong> </p>\n\n<p>If you are using top5 hotel clusters in <em>hotel_cluster</em>, this column will be five numbers as character (like &quot;5 37 55 11 8&quot;)</p>",
      "rawMarkdown": "Hi Sajni,\r\n\r\nEasy way:\r\n\r\n**write.csv(dataframe, file='submission.csv', row.names=FALSE)**\r\n\r\n*dataframe* is your data and *submission.csv* will be the file to submit.\r\n\r\n*dateframe* variable names must be *id* and *hotel_cluster* . You can use: \r\n\r\n**setnames(dataframe, c(\"id\", \"hotel_cluster\"))** \r\n\r\nIf you are using top5 hotel clusters in *hotel_cluster*, this column will be five numbers as character (like \"5 37 55 11 8\")",
      "votes": null
    },
    {
      "id": "118000",
      "postDate": "05/02/2016 12:08:03",
      "content": "<p>Another thing:</p>\n\n<p>If your 5 predictions are in separate columns first you might want to use </p>\n\n<pre><code>paste(x1,x2,x3,x4,x5, collapse=&quot; &quot;)\n</code></pre>\n\n<p>to create the needed string</p>\n\n<p>Gerhard</p>",
      "rawMarkdown": "Another thing:\r\n\r\nIf your 5 predictions are in separate columns first you might want to use \r\n\r\n    paste(x1,x2,x3,x4,x5, collapse=\" \")\r\n\r\nto create the needed string\r\n\r\nGerhard",
      "votes": null
    },
    {
      "id": "118090",
      "postDate": "05/02/2016 20:39:17",
      "content": "<p>Thanks! I managed to create it finally! \n:)</p>",
      "rawMarkdown": "Thanks! I managed to create it finally! \r\n:)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 117987,
      "author_name": "santiagomota",
      "author_url": "",
      "post_date": "05/02/2016 09:46:11",
      "content": "<p>Hi Sajni,</p>\n\n<p>Easy way:</p>\n\n<p><strong>write.csv(dataframe, file='submission.csv', row.names=FALSE)</strong></p>\n\n<p><em>dataframe</em> is your data and <em>submission.csv</em> will be the file to submit.</p>\n\n<p><em>dateframe</em> variable names must be <em>id</em> and <em>hotel_cluster</em> . You can use: </p>\n\n<p><strong>setnames(dataframe, c(&quot;id&quot;, &quot;hotel_cluster&quot;))</strong> </p>\n\n<p>If you are using top5 hotel clusters in <em>hotel_cluster</em>, this column will be five numbers as character (like &quot;5 37 55 11 8&quot;)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 118000,
      "author_name": "mightybird",
      "author_url": "",
      "post_date": "05/02/2016 12:08:03",
      "content": "<p>Another thing:</p>\n\n<p>If your 5 predictions are in separate columns first you might want to use </p>\n\n<pre><code>paste(x1,x2,x3,x4,x5, collapse=&quot; &quot;)\n</code></pre>\n\n<p>to create the needed string</p>\n\n<p>Gerhard</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 118090,
      "author_name": "smalde",
      "author_url": "",
      "post_date": "05/02/2016 20:39:17",
      "content": "<p>Thanks! I managed to create it finally! \n:)</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "117984": "Hi guys, \r\n\r\nI am a newbie to kaggle and R and I am stuck trying to create the submission file. what would you recommend is the best way to write the file? \r\n\r\nI have a data.frame (or data.table) file of 2528243 rows and 2 columns in the workspace and would like to save it as a csv? \r\n\r\n(Aside: is it efficient to assign the values of the top5 hotel clusters as a list to the 2nd column of data.frame? )\r\n\r\nI am open to alternate suggestions\r\n\r\n\r\nThanks\r\nSajni",
    "117987": "Hi Sajni,\r\n\r\nEasy way:\r\n\r\n**write.csv(dataframe, file='submission.csv', row.names=FALSE)**\r\n\r\n*dataframe* is your data and *submission.csv* will be the file to submit.\r\n\r\n*dateframe* variable names must be *id* and *hotel_cluster* . You can use: \r\n\r\n**setnames(dataframe, c(\"id\", \"hotel_cluster\"))** \r\n\r\nIf you are using top5 hotel clusters in *hotel_cluster*, this column will be five numbers as character (like \"5 37 55 11 8\")",
    "118000": "Another thing:\r\n\r\nIf your 5 predictions are in separate columns first you might want to use \r\n\r\n    paste(x1,x2,x3,x4,x5, collapse=\" \")\r\n\r\nto create the needed string\r\n\r\nGerhard",
    "118090": "Thanks! I managed to create it finally! \r\n:)"
  },
  "source": "meta"
}