{"action":"created","issue":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/1026","labels_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1026/labels{/name}","comments_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1026/comments","events_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1026/events","html_url":"https://github.com/Rdatatable/data.table/issues/1026","id":55658937,"number":1026,"title":"tstrsplit function to strsplit *and* transpose to easily split + update columns directly.","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},"labels":[{"url":"https://api.github.com/repos/Rdatatable/data.table/labels/feature%20request","name":"feature request","color":"734A82"}],"state":"closed","locked":false,"assignee":{"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},"milestone":{"url":"https://api.github.com/repos/Rdatatable/data.table/milestones/2","labels_url":"https://api.github.com/repos/Rdatatable/data.table/milestones/2/labels","id":780666,"number":2,"title":"v1.9.6","description":"Next release","creator":{"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},"open_issues":7,"closed_issues":73,"state":"open","created_at":"2014-09-06T12:24:59Z","updated_at":"2015-01-27T19:16:43Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-01-27T18:55:36Z","updated_at":"2015-01-27T19:25:08Z","closed_at":"2015-01-27T19:12:18Z","body":"This has come up quite frequently on SO. [Here](http://stackoverflow.com/q/27115832/559784) is one example. \r\n\r\nConceptually, `tstrsplit()` is just `transpose(strsplit(...), fill=.)` where `transpose()` is implemented in https://github.com/Rdatatable/data.table/issues/1025.\r\n\r\n```R\r\nrequire(data.table)\r\ndt <- data.table(category.tag=c(\"toys/David\", \"toys/David\", \"toys/James\", \"toys\", \"toys\", \"toys/James\"), transaction=1:6)\r\n#    category.tag transaction\r\n# 1:   toys/David           1\r\n# 2:   toys/David           2\r\n# 3:   toys/James           3\r\n# 4:         toys           4\r\n# 5:         toys           5\r\n# 6:   toys/James           6\r\n```\r\n\r\n```R\r\ndt[, c(\"category\", \"tag\") := tstrsplit(category.tag, \"/\", fixed=TRUE)]\r\n#    category.tag transaction category   tag\r\n# 1:   toys/David           1     toys David\r\n# 2:   toys/David           2     toys David\r\n# 3:   toys/James           3     toys James\r\n# 4:         toys           4     toys    NA\r\n# 5:         toys           5     toys    NA\r\n# 6:   toys/James           6     toys James\r\n```\r\n\r\nAdditionally we can also pass a `fill = ` argument to `tstrsplit`.\r\n"},"comment":{"url":"https://api.github.com/repos/Rdatatable/data.table/issues/comments/71710550","html_url":"https://github.com/Rdatatable/data.table/issues/1026#issuecomment-71710550","issue_url":"https://api.github.com/repos/Rdatatable/data.table/issues/1026","id":71710550,"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":"2015-01-27T19:25:08Z","updated_at":"2015-01-27T19:25:08Z","body":"Updated [this SO](http://stackoverflow.com/questions/27115832/split-a-column-of-strings-into-variable-number-of-columns-using-data-table-in-r/28178397#28178397) and [this SO](http://stackoverflow.com/questions/27115832/split-a-column-of-strings-into-variable-number-of-columns-using-data-table-in-r/28178397#28178397) posts."}}