{"action":"closed","number":87,"pull_request":{"url":"https://api.github.com/repos/rbchan/unmarked/pulls/87","id":51093660,"html_url":"https://github.com/rbchan/unmarked/pull/87","diff_url":"https://github.com/rbchan/unmarked/pull/87.diff","patch_url":"https://github.com/rbchan/unmarked/pull/87.patch","issue_url":"https://api.github.com/repos/rbchan/unmarked/issues/87","number":87,"state":"closed","locked":false,"title":"formatMult no longer corrupts covariates when factors are present; fixes #47","user":{"login":"adamdsmith","id":3195855,"avatar_url":"https://avatars.githubusercontent.com/u/3195855?v=3","gravatar_id":"","url":"https://api.github.com/users/adamdsmith","html_url":"https://github.com/adamdsmith","followers_url":"https://api.github.com/users/adamdsmith/followers","following_url":"https://api.github.com/users/adamdsmith/following{/other_user}","gists_url":"https://api.github.com/users/adamdsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/adamdsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamdsmith/subscriptions","organizations_url":"https://api.github.com/users/adamdsmith/orgs","repos_url":"https://api.github.com/users/adamdsmith/repos","events_url":"https://api.github.com/users/adamdsmith/events{/privacy}","received_events_url":"https://api.github.com/users/adamdsmith/received_events","type":"User","site_admin":false},"body":"```r\r\nlibrary(plyr); library(dplyr)\r\ntest <- expand.grid.df(expand.grid(site = LETTERS[1:10], visit = 1:3), \r\n                       data.frame(year = 2010:2012)) %>% arrange(site, year, visit) %>%\r\n                       select(year, site, visit)\r\ntest <- test %>% mutate(\r\n  y  = rpois(nrow(test), lambda = 2),\r\n  ocov = rnorm(nrow(test)),\r\n  scov = 2 * as.numeric(test$site),\r\n  yscov = 1.3 * as.numeric(interaction(test$site, test$year)))\r\n\r\n# All continuous\r\nnofac <- formatMult(test)\r\nstr(nofac)\r\n\r\n# Add factor variables to each group of variables (obsCovs, siteCovs, yearlysiteCovs)\r\ntest2 <- test %>% mutate(\r\n  obsfac = factor(sample(LETTERS[1:2], nrow(test), replace = TRUE)),\r\n  sitefac = factor(round_any(as.numeric(site), 5)),\r\n  ysfac = factor(round_any(as.numeric(interaction(site, year)), 10))\r\n)\r\n\r\nwithfac <- formatMult(test2) \r\nstr(withfac)\r\n\r\n# Only factor variables for each group variables (obsCovs, siteCovs, yearlysiteCovs)\r\ntest3 <- select(test2, -ocov, -scov, -yscov)\r\nonlyfac <- formatMult(test3)\r\nstr(onlyfac)\r\n\r\n(fm <- colext(~scov, ~1, ~1, ~ocov, nofac)) \r\n(fm2 <- colext(~scov + sitefac, ~1, ~1, ~ocov + obsfac + ysfac, withfac))  \r\n(fm3 <- colext(~sitefac, ~1, ~1, ~obsfac + sitefac + ysfac, onlyfac))  \r\n```","created_at":"2015-11-18T14:52:50Z","updated_at":"2015-11-18T17:22:46Z","closed_at":"2015-11-18T17:22:46Z","merged_at":"2015-11-18T17:22:46Z","merge_commit_sha":"7c9bdc12c9d5515557d9892ae507a3a2bbc7ab7d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rbchan/unmarked/pulls/87/commits","review_comments_url":"https://api.github.com/repos/rbchan/unmarked/pulls/87/comments","review_comment_url":"https://api.github.com/repos/rbchan/unmarked/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rbchan/unmarked/issues/87/comments","statuses_url":"https://api.github.com/repos/rbchan/unmarked/statuses/3788ef5c3ad112f0659b5e88bc491d6ba1f82f58","head":{"label":"adamdsmith:master","ref":"master","sha":"3788ef5c3ad112f0659b5e88bc491d6ba1f82f58","user":{"login":"adamdsmith","id":3195855,"avatar_url":"https://avatars.githubusercontent.com/u/3195855?v=3","gravatar_id":"","url":"https://api.github.com/users/adamdsmith","html_url":"https://github.com/adamdsmith","followers_url":"https://api.github.com/users/adamdsmith/followers","following_url":"https://api.github.com/users/adamdsmith/following{/other_user}","gists_url":"https://api.github.com/users/adamdsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/adamdsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamdsmith/subscriptions","organizations_url":"https://api.github.com/users/adamdsmith/orgs","repos_url":"https://api.github.com/users/adamdsmith/repos","events_url":"https://api.github.com/users/adamdsmith/events{/privacy}","received_events_url":"https://api.github.com/users/adamdsmith/received_events","type":"User","site_admin":false},"repo":{"id":46136181,"name":"unmarked","full_name":"adamdsmith/unmarked","owner":{"login":"adamdsmith","id":3195855,"avatar_url":"https://avatars.githubusercontent.com/u/3195855?v=3","gravatar_id":"","url":"https://api.github.com/users/adamdsmith","html_url":"https://github.com/adamdsmith","followers_url":"https://api.github.com/users/adamdsmith/followers","following_url":"https://api.github.com/users/adamdsmith/following{/other_user}","gists_url":"https://api.github.com/users/adamdsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/adamdsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamdsmith/subscriptions","organizations_url":"https://api.github.com/users/adamdsmith/orgs","repos_url":"https://api.github.com/users/adamdsmith/repos","events_url":"https://api.github.com/users/adamdsmith/events{/privacy}","received_events_url":"https://api.github.com/users/adamdsmith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adamdsmith/unmarked","description":"R package for hierarchical models in ecological research","fork":true,"url":"https://api.github.com/repos/adamdsmith/unmarked","forks_url":"https://api.github.com/repos/adamdsmith/unmarked/forks","keys_url":"https://api.github.com/repos/adamdsmith/unmarked/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adamdsmith/unmarked/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adamdsmith/unmarked/teams","hooks_url":"https://api.github.com/repos/adamdsmith/unmarked/hooks","issue_events_url":"https://api.github.com/repos/adamdsmith/unmarked/issues/events{/number}","events_url":"https://api.github.com/repos/adamdsmith/unmarked/events","assignees_url":"https://api.github.com/repos/adamdsmith/unmarked/assignees{/user}","branches_url":"https://api.github.com/repos/adamdsmith/unmarked/branches{/branch}","tags_url":"https://api.github.com/repos/adamdsmith/unmarked/tags","blobs_url":"https://api.github.com/repos/adamdsmith/unmarked/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adamdsmith/unmarked/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adamdsmith/unmarked/git/refs{/sha}","trees_url":"https://api.github.com/repos/adamdsmith/unmarked/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adamdsmith/unmarked/statuses/{sha}","languages_url":"https://api.github.com/repos/adamdsmith/unmarked/languages","stargazers_url":"https://api.github.com/repos/adamdsmith/unmarked/stargazers","contributors_url":"https://api.github.com/repos/adamdsmith/unmarked/contributors","subscribers_url":"https://api.github.com/repos/adamdsmith/unmarked/subscribers","subscription_url":"https://api.github.com/repos/adamdsmith/unmarked/subscription","commits_url":"https://api.github.com/repos/adamdsmith/unmarked/commits{/sha}","git_commits_url":"https://api.github.com/repos/adamdsmith/unmarked/git/commits{/sha}","comments_url":"https://api.github.com/repos/adamdsmith/unmarked/comments{/number}","issue_comment_url":"https://api.github.com/repos/adamdsmith/unmarked/issues/comments{/number}","contents_url":"https://api.github.com/repos/adamdsmith/unmarked/contents/{+path}","compare_url":"https://api.github.com/repos/adamdsmith/unmarked/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adamdsmith/unmarked/merges","archive_url":"https://api.github.com/repos/adamdsmith/unmarked/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adamdsmith/unmarked/downloads","issues_url":"https://api.github.com/repos/adamdsmith/unmarked/issues{/number}","pulls_url":"https://api.github.com/repos/adamdsmith/unmarked/pulls{/number}","milestones_url":"https://api.github.com/repos/adamdsmith/unmarked/milestones{/number}","notifications_url":"https://api.github.com/repos/adamdsmith/unmarked/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adamdsmith/unmarked/labels{/name}","releases_url":"https://api.github.com/repos/adamdsmith/unmarked/releases{/id}","created_at":"2015-11-13T17:14:40Z","updated_at":"2015-11-13T17:14:42Z","pushed_at":"2015-11-18T16:34:55Z","git_url":"git://github.com/adamdsmith/unmarked.git","ssh_url":"git@github.com:adamdsmith/unmarked.git","clone_url":"https://github.com/adamdsmith/unmarked.git","svn_url":"https://github.com/adamdsmith/unmarked","homepage":"https://sites.google.com/site/unmarkedinfo/","size":26260,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rbchan:master","ref":"master","sha":"330001915e30e31b4df930cdb7fd631999b3a3af","user":{"login":"rbchan","id":223370,"avatar_url":"https://avatars.githubusercontent.com/u/223370?v=3","gravatar_id":"","url":"https://api.github.com/users/rbchan","html_url":"https://github.com/rbchan","followers_url":"https://api.github.com/users/rbchan/followers","following_url":"https://api.github.com/users/rbchan/following{/other_user}","gists_url":"https://api.github.com/users/rbchan/gists{/gist_id}","starred_url":"https://api.github.com/users/rbchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbchan/subscriptions","organizations_url":"https://api.github.com/users/rbchan/orgs","repos_url":"https://api.github.com/users/rbchan/repos","events_url":"https://api.github.com/users/rbchan/events{/privacy}","received_events_url":"https://api.github.com/users/rbchan/received_events","type":"User","site_admin":false},"repo":{"id":564481,"name":"unmarked","full_name":"rbchan/unmarked","owner":{"login":"rbchan","id":223370,"avatar_url":"https://avatars.githubusercontent.com/u/223370?v=3","gravatar_id":"","url":"https://api.github.com/users/rbchan","html_url":"https://github.com/rbchan","followers_url":"https://api.github.com/users/rbchan/followers","following_url":"https://api.github.com/users/rbchan/following{/other_user}","gists_url":"https://api.github.com/users/rbchan/gists{/gist_id}","starred_url":"https://api.github.com/users/rbchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbchan/subscriptions","organizations_url":"https://api.github.com/users/rbchan/orgs","repos_url":"https://api.github.com/users/rbchan/repos","events_url":"https://api.github.com/users/rbchan/events{/privacy}","received_events_url":"https://api.github.com/users/rbchan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rbchan/unmarked","description":"R package for hierarchical models in ecological research","fork":true,"url":"https://api.github.com/repos/rbchan/unmarked","forks_url":"https://api.github.com/repos/rbchan/unmarked/forks","keys_url":"https://api.github.com/repos/rbchan/unmarked/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rbchan/unmarked/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rbchan/unmarked/teams","hooks_url":"https://api.github.com/repos/rbchan/unmarked/hooks","issue_events_url":"https://api.github.com/repos/rbchan/unmarked/issues/events{/number}","events_url":"https://api.github.com/repos/rbchan/unmarked/events","assignees_url":"https://api.github.com/repos/rbchan/unmarked/assignees{/user}","branches_url":"https://api.github.com/repos/rbchan/unmarked/branches{/branch}","tags_url":"https://api.github.com/repos/rbchan/unmarked/tags","blobs_url":"https://api.github.com/repos/rbchan/unmarked/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rbchan/unmarked/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rbchan/unmarked/git/refs{/sha}","trees_url":"https://api.github.com/repos/rbchan/unmarked/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rbchan/unmarked/statuses/{sha}","languages_url":"https://api.github.com/repos/rbchan/unmarked/languages","stargazers_url":"https://api.github.com/repos/rbchan/unmarked/stargazers","contributors_url":"https://api.github.com/repos/rbchan/unmarked/contributors","subscribers_url":"https://api.github.com/repos/rbchan/unmarked/subscribers","subscription_url":"https://api.github.com/repos/rbchan/unmarked/subscription","commits_url":"https://api.github.com/repos/rbchan/unmarked/commits{/sha}","git_commits_url":"https://api.github.com/repos/rbchan/unmarked/git/commits{/sha}","comments_url":"https://api.github.com/repos/rbchan/unmarked/comments{/number}","issue_comment_url":"https://api.github.com/repos/rbchan/unmarked/issues/comments{/number}","contents_url":"https://api.github.com/repos/rbchan/unmarked/contents/{+path}","compare_url":"https://api.github.com/repos/rbchan/unmarked/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rbchan/unmarked/merges","archive_url":"https://api.github.com/repos/rbchan/unmarked/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rbchan/unmarked/downloads","issues_url":"https://api.github.com/repos/rbchan/unmarked/issues{/number}","pulls_url":"https://api.github.com/repos/rbchan/unmarked/pulls{/number}","milestones_url":"https://api.github.com/repos/rbchan/unmarked/milestones{/number}","notifications_url":"https://api.github.com/repos/rbchan/unmarked/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rbchan/unmarked/labels{/name}","releases_url":"https://api.github.com/repos/rbchan/unmarked/releases{/id}","created_at":"2010-03-16T03:57:15Z","updated_at":"2015-08-20T12:21:10Z","pushed_at":"2015-11-18T17:22:46Z","git_url":"git://github.com/rbchan/unmarked.git","ssh_url":"git@github.com:rbchan/unmarked.git","clone_url":"https://github.com/rbchan/unmarked.git","svn_url":"https://github.com/rbchan/unmarked","homepage":"https://sites.google.com/site/unmarkedinfo/","size":26257,"stargazers_count":14,"watchers_count":14,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":19,"forks":12,"open_issues":19,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rbchan/unmarked/pulls/87"},"html":{"href":"https://github.com/rbchan/unmarked/pull/87"},"issue":{"href":"https://api.github.com/repos/rbchan/unmarked/issues/87"},"comments":{"href":"https://api.github.com/repos/rbchan/unmarked/issues/87/comments"},"review_comments":{"href":"https://api.github.com/repos/rbchan/unmarked/pulls/87/comments"},"review_comment":{"href":"https://api.github.com/repos/rbchan/unmarked/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rbchan/unmarked/pulls/87/commits"},"statuses":{"href":"https://api.github.com/repos/rbchan/unmarked/statuses/3788ef5c3ad112f0659b5e88bc491d6ba1f82f58"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"rbchan","id":223370,"avatar_url":"https://avatars.githubusercontent.com/u/223370?v=3","gravatar_id":"","url":"https://api.github.com/users/rbchan","html_url":"https://github.com/rbchan","followers_url":"https://api.github.com/users/rbchan/followers","following_url":"https://api.github.com/users/rbchan/following{/other_user}","gists_url":"https://api.github.com/users/rbchan/gists{/gist_id}","starred_url":"https://api.github.com/users/rbchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbchan/subscriptions","organizations_url":"https://api.github.com/users/rbchan/orgs","repos_url":"https://api.github.com/users/rbchan/repos","events_url":"https://api.github.com/users/rbchan/events{/privacy}","received_events_url":"https://api.github.com/users/rbchan/received_events","type":"User","site_admin":false},"comments":2,"review_comments":0,"commits":2,"additions":69,"deletions":0,"changed_files":2}}