{"action":"created","issue":{"url":"https://api.github.com/repos/tidyverse/glue/issues/28","repository_url":"https://api.github.com/repos/tidyverse/glue","labels_url":"https://api.github.com/repos/tidyverse/glue/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/tidyverse/glue/issues/28/comments","events_url":"https://api.github.com/repos/tidyverse/glue/issues/28/events","html_url":"https://github.com/tidyverse/glue/issues/28","id":230132701,"number":28,"title":"collapse() when x has length zero","user":{"login":"jennybc","id":599454,"avatar_url":"https://avatars0.githubusercontent.com/u/599454?v=3","gravatar_id":"","url":"https://api.github.com/users/jennybc","html_url":"https://github.com/jennybc","followers_url":"https://api.github.com/users/jennybc/followers","following_url":"https://api.github.com/users/jennybc/following{/other_user}","gists_url":"https://api.github.com/users/jennybc/gists{/gist_id}","starred_url":"https://api.github.com/users/jennybc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jennybc/subscriptions","organizations_url":"https://api.github.com/users/jennybc/orgs","repos_url":"https://api.github.com/users/jennybc/repos","events_url":"https://api.github.com/users/jennybc/events{/privacy}","received_events_url":"https://api.github.com/users/jennybc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-20T05:50:44Z","updated_at":"2017-05-22T12:08:39Z","closed_at":null,"body":"It feels like `collapse()` would be more consistent with `glue()` (and more convenient) if it returned `character(0)` if the input has length zero.\r\n\r\n``` r\r\nlibrary(glue)\r\nglue(\"{x}\", x = \"hi\")\r\n#> hi\r\nglue(\"{x}\", x = character(0))\r\n#> character(0)\r\ncollapse(x = c(\"hi\", \"bye\"), last = \" and \")\r\n#> [1] \"hi and bye\"\r\ncollapse(x = c(NULL, \"bye\"), last = \" and \")\r\n#> [1] \"bye\"\r\ncollapse(x = c(\"hi\", NULL), last = \" and \")\r\n#> [1] \"hi\"\r\ncollapse(x = NULL, last = \" and \")\r\n#> [1] \"\"\r\ncollapse(x = character(), last = \" and \")\r\n#> [1] \"\"\r\n```"},"comment":{"url":"https://api.github.com/repos/tidyverse/glue/issues/comments/303081799","html_url":"https://github.com/tidyverse/glue/issues/28#issuecomment-303081799","issue_url":"https://api.github.com/repos/tidyverse/glue/issues/28","id":303081799,"user":{"login":"jimhester","id":205275,"avatar_url":"https://avatars0.githubusercontent.com/u/205275?v=3","gravatar_id":"","url":"https://api.github.com/users/jimhester","html_url":"https://github.com/jimhester","followers_url":"https://api.github.com/users/jimhester/followers","following_url":"https://api.github.com/users/jimhester/following{/other_user}","gists_url":"https://api.github.com/users/jimhester/gists{/gist_id}","starred_url":"https://api.github.com/users/jimhester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimhester/subscriptions","organizations_url":"https://api.github.com/users/jimhester/orgs","repos_url":"https://api.github.com/users/jimhester/repos","events_url":"https://api.github.com/users/jimhester/events{/privacy}","received_events_url":"https://api.github.com/users/jimhester/received_events","type":"User","site_admin":false},"created_at":"2017-05-22T12:08:39Z","updated_at":"2017-05-22T12:08:39Z","body":"I think this was done deliberately to mimic \r\n```r\r\npaste(collapse = \"\", character())\r\n#> \"\"\r\n```\r\nBut I could be easily swayed to return `character()` here..."}}
{"actor":{"display_login":"jimhester"}}