{"action":"created","issue":{"url":"https://api.github.com/repos/hadley/lubridate/issues/315","labels_url":"https://api.github.com/repos/hadley/lubridate/issues/315/labels{/name}","comments_url":"https://api.github.com/repos/hadley/lubridate/issues/315/comments","events_url":"https://api.github.com/repos/hadley/lubridate/issues/315/events","html_url":"https://github.com/hadley/lubridate/issues/315","id":70461572,"number":315,"title":"unique() for Interval?","user":{"login":"mmuurr","id":5702538,"avatar_url":"https://avatars.githubusercontent.com/u/5702538?v=3","gravatar_id":"","url":"https://api.github.com/users/mmuurr","html_url":"https://github.com/mmuurr","followers_url":"https://api.github.com/users/mmuurr/followers","following_url":"https://api.github.com/users/mmuurr/following{/other_user}","gists_url":"https://api.github.com/users/mmuurr/gists{/gist_id}","starred_url":"https://api.github.com/users/mmuurr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmuurr/subscriptions","organizations_url":"https://api.github.com/users/mmuurr/orgs","repos_url":"https://api.github.com/users/mmuurr/repos","events_url":"https://api.github.com/users/mmuurr/events{/privacy}","received_events_url":"https://api.github.com/users/mmuurr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-23T17:01:51Z","updated_at":"2015-04-23T17:11:59Z","closed_at":null,"body":"unique() doesn't appear to be defined for class Interval, yet it silently runs and produces results that (I think) don't make sense.\r\n\r\nexample:\r\n```R\r\nfoo <- Sys.time() + days(1:4)\r\nints <- rep(interval(head(foo, -1), tail(foo, -1)), 2)\r\n## each interval is the same _duration_, and unique(ints) simply returns the unique durations (in seconds).\r\n## would (reasonably) expect the 3 unique _intervals_, instead.\r\nunique(ints)\r\n## [1] 86400\r\n```"},"comment":{"url":"https://api.github.com/repos/hadley/lubridate/issues/comments/95658087","html_url":"https://github.com/hadley/lubridate/issues/315#issuecomment-95658087","issue_url":"https://api.github.com/repos/hadley/lubridate/issues/315","id":95658087,"user":{"login":"mmuurr","id":5702538,"avatar_url":"https://avatars.githubusercontent.com/u/5702538?v=3","gravatar_id":"","url":"https://api.github.com/users/mmuurr","html_url":"https://github.com/mmuurr","followers_url":"https://api.github.com/users/mmuurr/followers","following_url":"https://api.github.com/users/mmuurr/following{/other_user}","gists_url":"https://api.github.com/users/mmuurr/gists{/gist_id}","starred_url":"https://api.github.com/users/mmuurr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmuurr/subscriptions","organizations_url":"https://api.github.com/users/mmuurr/orgs","repos_url":"https://api.github.com/users/mmuurr/repos","events_url":"https://api.github.com/users/mmuurr/events{/privacy}","received_events_url":"https://api.github.com/users/mmuurr/received_events","type":"User","site_admin":false},"created_at":"2015-04-23T17:11:59Z","updated_at":"2015-04-23T17:11:59Z","body":"quick add on why this could be useful: stratification by interval, e.g. by creating interval factors:\r\n```R\r\n## continuing the example code from above...\r\nfactor(ints)\r\n## [1] <NA> <NA> <NA> <NA> <NA> <NA>\r\n## Levels: 86400\r\n\r\nfoo <- data.frame(x = 1:6, ints = ints)\r\n## if dlply-ing over ints, would expect a length-3 vector of 2s... instead it's a length-1 vector of 6:\r\nunlist(dlply(foo, .(ints), nrow))\r\n```\r\n"}}