{"action":"created","issue":{"url":"https://api.github.com/repos/smbache/magrittr/issues/66","labels_url":"https://api.github.com/repos/smbache/magrittr/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/smbache/magrittr/issues/66/comments","events_url":"https://api.github.com/repos/smbache/magrittr/issues/66/events","html_url":"https://github.com/smbache/magrittr/issues/66","id":55777939,"number":66,"title":"Alias for set_class","user":{"login":"mostly-harmless","id":2998956,"avatar_url":"https://avatars.githubusercontent.com/u/2998956?v=3","gravatar_id":"","url":"https://api.github.com/users/mostly-harmless","html_url":"https://github.com/mostly-harmless","followers_url":"https://api.github.com/users/mostly-harmless/followers","following_url":"https://api.github.com/users/mostly-harmless/following{/other_user}","gists_url":"https://api.github.com/users/mostly-harmless/gists{/gist_id}","starred_url":"https://api.github.com/users/mostly-harmless/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mostly-harmless/subscriptions","organizations_url":"https://api.github.com/users/mostly-harmless/orgs","repos_url":"https://api.github.com/users/mostly-harmless/repos","events_url":"https://api.github.com/users/mostly-harmless/events{/privacy}","received_events_url":"https://api.github.com/users/mostly-harmless/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-28T16:21:31Z","updated_at":"2015-01-28T16:31:53Z","closed_at":null,"body":"Perhaps just:\r\n\r\n      set_class <- `class<-`"},"comment":{"url":"https://api.github.com/repos/smbache/magrittr/issues/comments/71866160","html_url":"https://github.com/smbache/magrittr/issues/66#issuecomment-71866160","issue_url":"https://api.github.com/repos/smbache/magrittr/issues/66","id":71866160,"user":{"login":"gaborcsardi","id":660288,"avatar_url":"https://avatars.githubusercontent.com/u/660288?v=3","gravatar_id":"","url":"https://api.github.com/users/gaborcsardi","html_url":"https://github.com/gaborcsardi","followers_url":"https://api.github.com/users/gaborcsardi/followers","following_url":"https://api.github.com/users/gaborcsardi/following{/other_user}","gists_url":"https://api.github.com/users/gaborcsardi/gists{/gist_id}","starred_url":"https://api.github.com/users/gaborcsardi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaborcsardi/subscriptions","organizations_url":"https://api.github.com/users/gaborcsardi/orgs","repos_url":"https://api.github.com/users/gaborcsardi/repos","events_url":"https://api.github.com/users/gaborcsardi/events{/privacy}","received_events_url":"https://api.github.com/users/gaborcsardi/received_events","type":"User","site_admin":false},"created_at":"2015-01-28T16:31:53Z","updated_at":"2015-01-28T16:31:53Z","body":"If you need to add a new class and keep existing ones, then you would need something like\r\n\r\n```r\r\nadd_class <- function(x, new_class) {\r\n  if (new_class %in% class(x)) {\r\n    x\r\n  } else {\r\n    class(x) <- c(new_class, class(x))\r\n    x\r\n  }\r\n}\r\n```\r\n\r\nBut I don't know which one people need more often. Also `set_class` might be confused with `setClass`. "}}