{"action":"created","comment":{"url":"https://api.github.com/repos/HughParsonage/grattan/pulls/comments/202864916","pull_request_review_id":137642782,"id":202864916,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMjg2NDkxNg==","diff_hunk":"@@ -0,0 +1,116 @@\n+#' Carer Payment\n+#' \n+#' Carer payment is available to those who provide constant for a person who has a physical, intellectual, or psychiatric disability. Note that many of the arguments relate to the individual who receives the care (indicated by not starting with 'carer_'). Payment is made to the carer and not to the person receiving the care.\n+#' \n+#' @param carer_fortnightly_income,carer_annual_income Carer's income for means-testing purposes. Provide one but not both.\n+#' @param carer_has_partner (logical, default: \\code{FALSE}) Does the carer have a partner?\n+#' @param carer_n_dependants How many dependants does the carer have? Default is zero.\n+#' @param carer_partner_fortnightly_income,carer_partner_annual_income The carer's partner's income.\n+#' @param Date,fy.year The financial year. Currently only 2015-16 is supported (the most recent survey of income and housing results).\n+#' @param carer_assets_value Total value of carer's household assets.\n+#' @param carer_is_home_owner (logical, default: \\code{FALSE}) Does the carer own their own home? \n+#' @param carer_illness_separated_couple Is the couple separated by illness? (Affects the assets test.)\n+#' @param dclad_eligible Is the person receiving care a DCLAD qualifying child as defined in http://guides.dss.gov.au/guide-social-security-law/1/1/q/17 ?\n+#' @param low_adat,high_adat Does the person receiving care have a low or high ADAT score as defined in http://guides.dss.gov.au/guide-social-security-law/1/1/a/78 ?\n+#' @param living_at_home Does the person receiving care live at home with their parents?\n+#' @param care_receiver_fortnightly_income Care receiver's fortnightly income\n+#' @param care_receiver_asset_value Care receiver's asset value\n+#' @param partner_annual_income Care receiver's partner's annual income\n+#' @param partner_asset_value Care receiver's partner's asset value\n+#' @param children_annual_income Care receiver's partner's annual income\n+#' @param children_asset_value Care receiver's children's asset value\n+#' @param receiving_other_payment Is the care receiver receiving other social security payments?\n+#' \n+#' @author Matthew Katzen\n+#' @export carer_payment\n+#' \n+#' \n+carer_payment <- function(Date = NULL,\n+                          fy.year = NULL,\n+                          carer_fortnightly_income = 0, \n+                          carer_annual_income = carer_fortnightly_income * 26, \n+                          carer_has_partner = FALSE,\n+                          carer_n_dependants = 0L,\n+                          carer_partner_fortnightly_income = 0,\n+                          carer_partner_annual_income = carer_partner_fortnightly_income * 26,\n+                          carer_assets_value = 0,\n+                          carer_is_home_owner = FALSE,\n+                          carer_illness_separated_couple = FALSE,\n+                          #care receiver arguments\n+                          dclad_eligible = TRUE,\n+                          low_adat = FALSE,\n+                          high_adat = FALSE,\n+                          living_at_home = FALSE,\n+                          receiving_other_payment = FALSE,\n+                          care_receiver_fortnightly_income = 0,\n+                          care_receiver_annual_income = 0,\n+                          care_receiver_asset_value = 0,\n+                          partner_annual_income = 0,\n+                          partner_asset_value = 0,\n+                          children_annual_income = 0,\n+                          children_asset_value = 0\n+                          ) {\n+  \n+  if (is.null(Date)) {\n+    if (is.null(fy.year)) {\n+      Date <- .age_pension_today2qtr(Sys.Date())\n+      fy.year <- date2fy(Date)\n+      message('`Date` and `fy.year` not set, so using `Date = \"', Date, '\".')\n+    } else {\n+      Date <- fy2date(fy.year)\n+    }\n+  } else {\n+    if (is.null(fy.year)) {\n+      fy.year <- date2fy(Date)\n+    } else {\n+      warning(\"`fy.year` and `Date` both used. Ignoring `fy.year`.\")\n+    }\n+  }\n+  \n+  #error for no dclad or adat\n+  \n+  input <- data.table(do.call(cbind.data.frame, mget(ls())))\n+\n+  #Rates, income test, and asset test same as age pension\n+\n+  rate <- age_pension(ordinary_income = carer_fortnightly_income,\n+                      annual_income = carer_annual_income,\n+                      has_partner = carer_has_partner,\n+                      n_dependants = carer_n_dependants,\n+                      partner_fortnightly_income = carer_partner_fortnightly_income,\n+                      partner_annual_income = carer_partner_annual_income,\n+                      Date = Date,\n+                      assets_value = carer_assets_value,\n+                      is_home_owner = carer_is_home_owner,\n+                      illness_separated_couple = carer_illness_separated_couple)\n+\n+  \n+\n+  #http://guides.dss.gov.au/guide-social-security-law/4/2/5\n+  #https://www.humanservices.gov.au/sites/default/files/co029-1603en.pdf\n+  \n+  #detailed eligibility: http://guides.dss.gov.au/guide-social-security-law/3/6/4\n+  care_receiver_eligible <- input[ ,(dclad_eligible | high_adat | low_adat)]\n+\n+  care_receiver_income_test <- input[ ,if_else(high_adat,\n+                                               care_receiver_annual_income + partner_annual_income, #high adat\n+                                               if_else(dclad_eligible & living_at_home,\n+                                                       care_receiver_annual_income, #child living away from home\n+                                                       care_receiver_annual_income + partner_annual_income + children_annual_income))] #all other cases\n+  \n+  care_receiver_asset_test <- input[ ,if_else(dclad_eligible & !living_at_home,\n+                            care_receiver_asset_value, #child living away from home\n+                            care_receiver_asset_value + partner_asset_value + children_asset_value)] #all other cases\n+\n+  income_eligible <- input[ ,if_else(high_adat & receiving_other_payment, #exemption: http://guides.dss.gov.au/guide-social-security-law/3/6/4/10\n+                                      TRUE,\n+                                      (care_receiver_income_test < 108828))]\n+  assets_eligible <- input[ ,if_else(high_adat & receiving_other_payment,\n+                                      TRUE,\n+                                      (care_receiver_asset_test < 671250))]","path":"R/carer_payment.R","position":110,"original_position":110,"commit_id":"a697d765a5697cff93ac6bd142e88b278f2becdb","original_commit_id":"a697d765a5697cff93ac6bd142e88b278f2becdb","user":{"login":"HughParsonage","id":8111628,"node_id":"MDQ6VXNlcjgxMTE2Mjg=","avatar_url":"https://avatars1.githubusercontent.com/u/8111628?v=4","gravatar_id":"","url":"https://api.github.com/users/HughParsonage","html_url":"https://github.com/HughParsonage","followers_url":"https://api.github.com/users/HughParsonage/followers","following_url":"https://api.github.com/users/HughParsonage/following{/other_user}","gists_url":"https://api.github.com/users/HughParsonage/gists{/gist_id}","starred_url":"https://api.github.com/users/HughParsonage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HughParsonage/subscriptions","organizations_url":"https://api.github.com/users/HughParsonage/orgs","repos_url":"https://api.github.com/users/HughParsonage/repos","events_url":"https://api.github.com/users/HughParsonage/events{/privacy}","received_events_url":"https://api.github.com/users/HughParsonage/received_events","type":"User","site_admin":false},"body":"I meant the `if_else`: \r\n\r\n```r\r\nassets_eligible <- input[, or(high_adat & receiving_other_payment, care_receiver_asset_test < 671250)]\r\n```","created_at":"2018-07-17T00:28:54Z","updated_at":"2018-07-17T00:28:54Z","html_url":"https://github.com/HughParsonage/grattan/pull/111#discussion_r202864916","pull_request_url":"https://api.github.com/repos/HughParsonage/grattan/pulls/111","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/HughParsonage/grattan/pulls/comments/202864916"},"html":{"href":"https://github.com/HughParsonage/grattan/pull/111#discussion_r202864916"},"pull_request":{"href":"https://api.github.com/repos/HughParsonage/grattan/pulls/111"}},"in_reply_to_id":202666051},"pull_request":{"url":"https://api.github.com/repos/HughParsonage/grattan/pulls/111","id":201570908,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxNTcwOTA4","html_url":"https://github.com/HughParsonage/grattan/pull/111","diff_url":"https://github.com/HughParsonage/grattan/pull/111.diff","patch_url":"https://github.com/HughParsonage/grattan/pull/111.patch","issue_url":"https://api.github.com/repos/HughParsonage/grattan/issues/111","number":111,"state":"open","locked":false,"title":"Carer payment","user":{"login":"MatthewKatzen","id":20633283,"node_id":"MDQ6VXNlcjIwNjMzMjgz","avatar_url":"https://avatars2.githubusercontent.com/u/20633283?v=4","gravatar_id":"","url":"https://api.github.com/users/MatthewKatzen","html_url":"https://github.com/MatthewKatzen","followers_url":"https://api.github.com/users/MatthewKatzen/followers","following_url":"https://api.github.com/users/MatthewKatzen/following{/other_user}","gists_url":"https://api.github.com/users/MatthewKatzen/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthewKatzen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthewKatzen/subscriptions","organizations_url":"https://api.github.com/users/MatthewKatzen/orgs","repos_url":"https://api.github.com/users/MatthewKatzen/repos","events_url":"https://api.github.com/users/MatthewKatzen/events{/privacy}","received_events_url":"https://api.github.com/users/MatthewKatzen/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-16T08:38:43Z","updated_at":"2018-07-17T00:28:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e206bce565af9e6fb46d78868a00b68b26cdec94","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/HughParsonage/grattan/pulls/111/commits","review_comments_url":"https://api.github.com/repos/HughParsonage/grattan/pulls/111/comments","review_comment_url":"https://api.github.com/repos/HughParsonage/grattan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HughParsonage/grattan/issues/111/comments","statuses_url":"https://api.github.com/repos/HughParsonage/grattan/statuses/a697d765a5697cff93ac6bd142e88b278f2becdb","head":{"label":"HughParsonage:carer-payment","ref":"carer-payment","sha":"a697d765a5697cff93ac6bd142e88b278f2becdb","user":{"login":"HughParsonage","id":8111628,"node_id":"MDQ6VXNlcjgxMTE2Mjg=","avatar_url":"https://avatars1.githubusercontent.com/u/8111628?v=4","gravatar_id":"","url":"https://api.github.com/users/HughParsonage","html_url":"https://github.com/HughParsonage","followers_url":"https://api.github.com/users/HughParsonage/followers","following_url":"https://api.github.com/users/HughParsonage/following{/other_user}","gists_url":"https://api.github.com/users/HughParsonage/gists{/gist_id}","starred_url":"https://api.github.com/users/HughParsonage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HughParsonage/subscriptions","organizations_url":"https://api.github.com/users/HughParsonage/orgs","repos_url":"https://api.github.com/users/HughParsonage/repos","events_url":"https://api.github.com/users/HughParsonage/events{/privacy}","received_events_url":"https://api.github.com/users/HughParsonage/received_events","type":"User","site_admin":false},"repo":{"id":30398321,"node_id":"MDEwOlJlcG9zaXRvcnkzMDM5ODMyMQ==","name":"grattan","full_name":"HughParsonage/grattan","owner":{"login":"HughParsonage","id":8111628,"node_id":"MDQ6VXNlcjgxMTE2Mjg=","avatar_url":"https://avatars1.githubusercontent.com/u/8111628?v=4","gravatar_id":"","url":"https://api.github.com/users/HughParsonage","html_url":"https://github.com/HughParsonage","followers_url":"https://api.github.com/users/HughParsonage/followers","following_url":"https://api.github.com/users/HughParsonage/following{/other_user}","gists_url":"https://api.github.com/users/HughParsonage/gists{/gist_id}","starred_url":"https://api.github.com/users/HughParsonage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HughParsonage/subscriptions","organizations_url":"https://api.github.com/users/HughParsonage/orgs","repos_url":"https://api.github.com/users/HughParsonage/repos","events_url":"https://api.github.com/users/HughParsonage/events{/privacy}","received_events_url":"https://api.github.com/users/HughParsonage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/HughParsonage/grattan","description":"Common quantitative tasks for Australian policy analysts","fork":false,"url":"https://api.github.com/repos/HughParsonage/grattan","forks_url":"https://api.github.com/repos/HughParsonage/grattan/forks","keys_url":"https://api.github.com/repos/HughParsonage/grattan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HughParsonage/grattan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HughParsonage/grattan/teams","hooks_url":"https://api.github.com/repos/HughParsonage/grattan/hooks","issue_events_url":"https://api.github.com/repos/HughParsonage/grattan/issues/events{/number}","events_url":"https://api.github.com/repos/HughParsonage/grattan/events","assignees_url":"https://api.github.com/repos/HughParsonage/grattan/assignees{/user}","branches_url":"https://api.github.com/repos/HughParsonage/grattan/branches{/branch}","tags_url":"https://api.github.com/repos/HughParsonage/grattan/tags","blobs_url":"https://api.github.com/repos/HughParsonage/grattan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HughParsonage/grattan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HughParsonage/grattan/git/refs{/sha}","trees_url":"https://api.github.com/repos/HughParsonage/grattan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HughParsonage/grattan/statuses/{sha}","languages_url":"https://api.github.com/repos/HughParsonage/grattan/languages","stargazers_url":"https://api.github.com/repos/HughParsonage/grattan/stargazers","contributors_url":"https://api.github.com/repos/HughParsonage/grattan/contributors","subscribers_url":"https://api.github.com/repos/HughParsonage/grattan/subscribers","subscription_url":"https://api.github.com/repos/HughParsonage/grattan/subscription","commits_url":"https://api.github.com/repos/HughParsonage/grattan/commits{/sha}","git_commits_url":"https://api.github.com/repos/HughParsonage/grattan/git/commits{/sha}","comments_url":"https://api.github.com/repos/HughParsonage/grattan/comments{/number}","issue_comment_url":"https://api.github.com/repos/HughParsonage/grattan/issues/comments{/number}","contents_url":"https://api.github.com/repos/HughParsonage/grattan/contents/{+path}","compare_url":"https://api.github.com/repos/HughParsonage/grattan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HughParsonage/grattan/merges","archive_url":"https://api.github.com/repos/HughParsonage/grattan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HughParsonage/grattan/downloads","issues_url":"https://api.github.com/repos/HughParsonage/grattan/issues{/number}","pulls_url":"https://api.github.com/repos/HughParsonage/grattan/pulls{/number}","milestones_url":"https://api.github.com/repos/HughParsonage/grattan/milestones{/number}","notifications_url":"https://api.github.com/repos/HughParsonage/grattan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HughParsonage/grattan/labels{/name}","releases_url":"https://api.github.com/repos/HughParsonage/grattan/releases{/id}","deployments_url":"https://api.github.com/repos/HughParsonage/grattan/deployments","created_at":"2015-02-06T06:18:13Z","updated_at":"2018-07-10T02:00:15Z","pushed_at":"2018-07-16T08:38:43Z","git_url":"git://github.com/HughParsonage/grattan.git","ssh_url":"git@github.com:HughParsonage/grattan.git","clone_url":"https://github.com/HughParsonage/grattan.git","svn_url":"https://github.com/HughParsonage/grattan","homepage":"","size":172013,"stargazers_count":8,"watchers_count":8,"language":"R","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":19,"license":null,"forks":6,"open_issues":19,"watchers":8,"default_branch":"master"}},"base":{"label":"HughParsonage:allowances","ref":"allowances","sha":"0a3fc348a798a91e1686bb6403e6d03ad980930c","user":{"login":"HughParsonage","id":8111628,"node_id":"MDQ6VXNlcjgxMTE2Mjg=","avatar_url":"https://avatars1.githubusercontent.com/u/8111628?v=4","gravatar_id":"","url":"https://api.github.com/users/HughParsonage","html_url":"https://github.com/HughParsonage","followers_url":"https://api.github.com/users/HughParsonage/followers","following_url":"https://api.github.com/users/HughParsonage/following{/other_user}","gists_url":"https://api.github.com/users/HughParsonage/gists{/gist_id}","starred_url":"https://api.github.com/users/HughParsonage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HughParsonage/subscriptions","organizations_url":"https://api.github.com/users/HughParsonage/orgs","repos_url":"https://api.github.com/users/HughParsonage/repos","events_url":"https://api.github.com/users/HughParsonage/events{/privacy}","received_events_url":"https://api.github.com/users/HughParsonage/received_events","type":"User","site_admin":false},"repo":{"id":30398321,"node_id":"MDEwOlJlcG9zaXRvcnkzMDM5ODMyMQ==","name":"grattan","full_name":"HughParsonage/grattan","owner":{"login":"HughParsonage","id":8111628,"node_id":"MDQ6VXNlcjgxMTE2Mjg=","avatar_url":"https://avatars1.githubusercontent.com/u/8111628?v=4","gravatar_id":"","url":"https://api.github.com/users/HughParsonage","html_url":"https://github.com/HughParsonage","followers_url":"https://api.github.com/users/HughParsonage/followers","following_url":"https://api.github.com/users/HughParsonage/following{/other_user}","gists_url":"https://api.github.com/users/HughParsonage/gists{/gist_id}","starred_url":"https://api.github.com/users/HughParsonage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HughParsonage/subscriptions","organizations_url":"https://api.github.com/users/HughParsonage/orgs","repos_url":"https://api.github.com/users/HughParsonage/repos","events_url":"https://api.github.com/users/HughParsonage/events{/privacy}","received_events_url":"https://api.github.com/users/HughParsonage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/HughParsonage/grattan","description":"Common quantitative tasks for Australian policy analysts","fork":false,"url":"https://api.github.com/repos/HughParsonage/grattan","forks_url":"https://api.github.com/repos/HughParsonage/grattan/forks","keys_url":"https://api.github.com/repos/HughParsonage/grattan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HughParsonage/grattan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HughParsonage/grattan/teams","hooks_url":"https://api.github.com/repos/HughParsonage/grattan/hooks","issue_events_url":"https://api.github.com/repos/HughParsonage/grattan/issues/events{/number}","events_url":"https://api.github.com/repos/HughParsonage/grattan/events","assignees_url":"https://api.github.com/repos/HughParsonage/grattan/assignees{/user}","branches_url":"https://api.github.com/repos/HughParsonage/grattan/branches{/branch}","tags_url":"https://api.github.com/repos/HughParsonage/grattan/tags","blobs_url":"https://api.github.com/repos/HughParsonage/grattan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HughParsonage/grattan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HughParsonage/grattan/git/refs{/sha}","trees_url":"https://api.github.com/repos/HughParsonage/grattan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HughParsonage/grattan/statuses/{sha}","languages_url":"https://api.github.com/repos/HughParsonage/grattan/languages","stargazers_url":"https://api.github.com/repos/HughParsonage/grattan/stargazers","contributors_url":"https://api.github.com/repos/HughParsonage/grattan/contributors","subscribers_url":"https://api.github.com/repos/HughParsonage/grattan/subscribers","subscription_url":"https://api.github.com/repos/HughParsonage/grattan/subscription","commits_url":"https://api.github.com/repos/HughParsonage/grattan/commits{/sha}","git_commits_url":"https://api.github.com/repos/HughParsonage/grattan/git/commits{/sha}","comments_url":"https://api.github.com/repos/HughParsonage/grattan/comments{/number}","issue_comment_url":"https://api.github.com/repos/HughParsonage/grattan/issues/comments{/number}","contents_url":"https://api.github.com/repos/HughParsonage/grattan/contents/{+path}","compare_url":"https://api.github.com/repos/HughParsonage/grattan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HughParsonage/grattan/merges","archive_url":"https://api.github.com/repos/HughParsonage/grattan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HughParsonage/grattan/downloads","issues_url":"https://api.github.com/repos/HughParsonage/grattan/issues{/number}","pulls_url":"https://api.github.com/repos/HughParsonage/grattan/pulls{/number}","milestones_url":"https://api.github.com/repos/HughParsonage/grattan/milestones{/number}","notifications_url":"https://api.github.com/repos/HughParsonage/grattan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HughParsonage/grattan/labels{/name}","releases_url":"https://api.github.com/repos/HughParsonage/grattan/releases{/id}","deployments_url":"https://api.github.com/repos/HughParsonage/grattan/deployments","created_at":"2015-02-06T06:18:13Z","updated_at":"2018-07-10T02:00:15Z","pushed_at":"2018-07-16T08:38:43Z","git_url":"git://github.com/HughParsonage/grattan.git","ssh_url":"git@github.com:HughParsonage/grattan.git","clone_url":"https://github.com/HughParsonage/grattan.git","svn_url":"https://github.com/HughParsonage/grattan","homepage":"","size":172013,"stargazers_count":8,"watchers_count":8,"language":"R","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":19,"license":null,"forks":6,"open_issues":19,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HughParsonage/grattan/pulls/111"},"html":{"href":"https://github.com/HughParsonage/grattan/pull/111"},"issue":{"href":"https://api.github.com/repos/HughParsonage/grattan/issues/111"},"comments":{"href":"https://api.github.com/repos/HughParsonage/grattan/issues/111/comments"},"review_comments":{"href":"https://api.github.com/repos/HughParsonage/grattan/pulls/111/comments"},"review_comment":{"href":"https://api.github.com/repos/HughParsonage/grattan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HughParsonage/grattan/pulls/111/commits"},"statuses":{"href":"https://api.github.com/repos/HughParsonage/grattan/statuses/a697d765a5697cff93ac6bd142e88b278f2becdb"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"HughParsonage"}}