{"action":"created","comment":{"url":"https://api.github.com/repos/rstudio/gt/pulls/comments/272635620","pull_request_review_id":223337069,"id":272635620,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI3MjYzNTYyMA==","diff_hunk":"@@ -361,9 +358,174 @@ paste_currency_str <- function(x,\n           direction = placement\n         ) %>%\n         paste_on_side(\n-          x_side = currency_str,\n+          x_side = symbol_str,\n           direction = placement\n         )\n     }\n   })\n }\n+\n+#' @noRd\n+format_in_accounting_style <- function(x,\n+                                       x_vals,\n+                                       accounting,\n+                                       minus_mark,\n+                                       parens_marks) {\n+\n+  # Return values unchanged if there are no negative values\n+  if (!any(x_vals < 0)) {\n+    return(x)\n+  }\n+\n+  # Handle replacement of the minus mark\n+  x <-\n+    x %>%\n+    tidy_gsub(\"-\", minus_mark, fixed = TRUE)\n+\n+  # Handle case where negative values are to be placed within parentheses\n+  if (accounting) {\n+\n+    # Selectively remove minus sign and paste between parentheses\n+    x[x_vals < 0] <-\n+      x[x_vals < 0] %>%\n+      tidy_gsub(minus_mark, \"\", fixed = TRUE) %>%\n+      paste_between(x_2 = parens_marks)\n+  }\n+\n+  x\n+}\n+\n+#' @noRd\n+prettify_scientific_notation <- function(x,\n+                                         small_pos,\n+                                         exp_marks,\n+                                         minus_mark) {\n+\n+  if (!any(grepl(\"e|E\", x))) {\n+    return(x)\n+  }\n+\n+  # For any numbers that shouldn't have an exponent, remove\n+  # that portion from the character version\n+  x[small_pos] <-\n+    split_scientific_notn(x[small_pos])$num\n+\n+  # For any non-NA numbers that do have an exponent, format\n+  # those according to the output context\n+  sci_parts <- split_scientific_notn(x[!small_pos])\n+\n+  x[!small_pos] <-\n+    paste0(\n+      sci_parts$num, exp_marks[1],\n+      sci_parts$exp, exp_marks[2]\n+    )\n+\n+  # Handle replacement of the minus mark in number\n+  # and exponent parts\n+  x %>%\n+    tidy_gsub(\"-\", minus_mark, fixed = TRUE)\n+}\n+\n+#' @noRd\n+num_formatter_factory <- function(context,\n+                                  decimals = NULL,\n+                                  suffix_labels = NULL,\n+                                  scale_by = NULL,\n+                                  sep_mark = NULL,\n+                                  dec_mark = NULL,\n+                                  currency = NULL,\n+                                  drop_trailing_zeros = NULL,\n+                                  accounting = NULL,\n+                                  incl_space = NULL,\n+                                  placement = NULL,\n+                                  pattern = NULL,\n+                                  format_fn = NULL) {\n+\n+  force(context)","path":"R/utils_formatters.R","position":206,"original_position":206,"commit_id":"e846841614fee9d875e583ab64238a5ee88a1609","original_commit_id":"e846841614fee9d875e583ab64238a5ee88a1609","user":{"login":"rich-iannone","id":5612024,"node_id":"MDQ6VXNlcjU2MTIwMjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5612024?v=4","gravatar_id":"","url":"https://api.github.com/users/rich-iannone","html_url":"https://github.com/rich-iannone","followers_url":"https://api.github.com/users/rich-iannone/followers","following_url":"https://api.github.com/users/rich-iannone/following{/other_user}","gists_url":"https://api.github.com/users/rich-iannone/gists{/gist_id}","starred_url":"https://api.github.com/users/rich-iannone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rich-iannone/subscriptions","organizations_url":"https://api.github.com/users/rich-iannone/orgs","repos_url":"https://api.github.com/users/rich-iannone/repos","events_url":"https://api.github.com/users/rich-iannone/events{/privacy}","received_events_url":"https://api.github.com/users/rich-iannone/received_events","type":"User","site_admin":false},"body":"`force(list(a, b, c, ...))`","created_at":"2019-04-05T15:22:12Z","updated_at":"2019-04-05T15:22:12Z","html_url":"https://github.com/rstudio/gt/pull/244#discussion_r272635620","pull_request_url":"https://api.github.com/repos/rstudio/gt/pulls/244","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/rstudio/gt/pulls/comments/272635620"},"html":{"href":"https://github.com/rstudio/gt/pull/244#discussion_r272635620"},"pull_request":{"href":"https://api.github.com/repos/rstudio/gt/pulls/244"}},"in_reply_to_id":272635452},"pull_request":{"url":"https://api.github.com/repos/rstudio/gt/pulls/244","id":266882071,"node_id":"MDExOlB1bGxSZXF1ZXN0MjY2ODgyMDcx","html_url":"https://github.com/rstudio/gt/pull/244","diff_url":"https://github.com/rstudio/gt/pull/244.diff","patch_url":"https://github.com/rstudio/gt/pull/244.patch","issue_url":"https://api.github.com/repos/rstudio/gt/issues/244","number":244,"state":"open","locked":false,"title":"Make several refactoring improvements to some `format_*()` functions","user":{"login":"rich-iannone","id":5612024,"node_id":"MDQ6VXNlcjU2MTIwMjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/5612024?v=4","gravatar_id":"","url":"https://api.github.com/users/rich-iannone","html_url":"https://github.com/rich-iannone","followers_url":"https://api.github.com/users/rich-iannone/followers","following_url":"https://api.github.com/users/rich-iannone/following{/other_user}","gists_url":"https://api.github.com/users/rich-iannone/gists{/gist_id}","starred_url":"https://api.github.com/users/rich-iannone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rich-iannone/subscriptions","organizations_url":"https://api.github.com/users/rich-iannone/orgs","repos_url":"https://api.github.com/users/rich-iannone/repos","events_url":"https://api.github.com/users/rich-iannone/events{/privacy}","received_events_url":"https://api.github.com/users/rich-iannone/received_events","type":"User","site_admin":false},"body":"These changes provide a few more improvements to some `format_*()` functions and related utility functions.","created_at":"2019-04-03T03:43:25Z","updated_at":"2019-04-05T15:22:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51d82ff3fb58bd71dace68f9e36144b6f1ce8f0b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rstudio/gt/pulls/244/commits","review_comments_url":"https://api.github.com/repos/rstudio/gt/pulls/244/comments","review_comment_url":"https://api.github.com/repos/rstudio/gt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rstudio/gt/issues/244/comments","statuses_url":"https://api.github.com/repos/rstudio/gt/statuses/e846841614fee9d875e583ab64238a5ee88a1609","head":{"label":"rstudio:format-data-improvements","ref":"format-data-improvements","sha":"e846841614fee9d875e583ab64238a5ee88a1609","user":{"login":"rstudio","id":513560,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUxMzU2MA==","avatar_url":"https://avatars1.githubusercontent.com/u/513560?v=4","gravatar_id":"","url":"https://api.github.com/users/rstudio","html_url":"https://github.com/rstudio","followers_url":"https://api.github.com/users/rstudio/followers","following_url":"https://api.github.com/users/rstudio/following{/other_user}","gists_url":"https://api.github.com/users/rstudio/gists{/gist_id}","starred_url":"https://api.github.com/users/rstudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstudio/subscriptions","organizations_url":"https://api.github.com/users/rstudio/orgs","repos_url":"https://api.github.com/users/rstudio/repos","events_url":"https://api.github.com/users/rstudio/events{/privacy}","received_events_url":"https://api.github.com/users/rstudio/received_events","type":"Organization","site_admin":false},"repo":{"id":126038547,"node_id":"MDEwOlJlcG9zaXRvcnkxMjYwMzg1NDc=","name":"gt","full_name":"rstudio/gt","private":false,"owner":{"login":"rstudio","id":513560,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUxMzU2MA==","avatar_url":"https://avatars1.githubusercontent.com/u/513560?v=4","gravatar_id":"","url":"https://api.github.com/users/rstudio","html_url":"https://github.com/rstudio","followers_url":"https://api.github.com/users/rstudio/followers","following_url":"https://api.github.com/users/rstudio/following{/other_user}","gists_url":"https://api.github.com/users/rstudio/gists{/gist_id}","starred_url":"https://api.github.com/users/rstudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstudio/subscriptions","organizations_url":"https://api.github.com/users/rstudio/orgs","repos_url":"https://api.github.com/users/rstudio/repos","events_url":"https://api.github.com/users/rstudio/events{/privacy}","received_events_url":"https://api.github.com/users/rstudio/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/rstudio/gt","description":"Easily generate information-rich, publication-quality tables from R","fork":false,"url":"https://api.github.com/repos/rstudio/gt","forks_url":"https://api.github.com/repos/rstudio/gt/forks","keys_url":"https://api.github.com/repos/rstudio/gt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rstudio/gt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rstudio/gt/teams","hooks_url":"https://api.github.com/repos/rstudio/gt/hooks","issue_events_url":"https://api.github.com/repos/rstudio/gt/issues/events{/number}","events_url":"https://api.github.com/repos/rstudio/gt/events","assignees_url":"https://api.github.com/repos/rstudio/gt/assignees{/user}","branches_url":"https://api.github.com/repos/rstudio/gt/branches{/branch}","tags_url":"https://api.github.com/repos/rstudio/gt/tags","blobs_url":"https://api.github.com/repos/rstudio/gt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rstudio/gt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rstudio/gt/git/refs{/sha}","trees_url":"https://api.github.com/repos/rstudio/gt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rstudio/gt/statuses/{sha}","languages_url":"https://api.github.com/repos/rstudio/gt/languages","stargazers_url":"https://api.github.com/repos/rstudio/gt/stargazers","contributors_url":"https://api.github.com/repos/rstudio/gt/contributors","subscribers_url":"https://api.github.com/repos/rstudio/gt/subscribers","subscription_url":"https://api.github.com/repos/rstudio/gt/subscription","commits_url":"https://api.github.com/repos/rstudio/gt/commits{/sha}","git_commits_url":"https://api.github.com/repos/rstudio/gt/git/commits{/sha}","comments_url":"https://api.github.com/repos/rstudio/gt/comments{/number}","issue_comment_url":"https://api.github.com/repos/rstudio/gt/issues/comments{/number}","contents_url":"https://api.github.com/repos/rstudio/gt/contents/{+path}","compare_url":"https://api.github.com/repos/rstudio/gt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rstudio/gt/merges","archive_url":"https://api.github.com/repos/rstudio/gt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rstudio/gt/downloads","issues_url":"https://api.github.com/repos/rstudio/gt/issues{/number}","pulls_url":"https://api.github.com/repos/rstudio/gt/pulls{/number}","milestones_url":"https://api.github.com/repos/rstudio/gt/milestones{/number}","notifications_url":"https://api.github.com/repos/rstudio/gt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rstudio/gt/labels{/name}","releases_url":"https://api.github.com/repos/rstudio/gt/releases{/id}","deployments_url":"https://api.github.com/repos/rstudio/gt/deployments","created_at":"2018-03-20T15:18:51Z","updated_at":"2019-04-05T08:52:31Z","pushed_at":"2019-04-05T14:41:02Z","git_url":"git://github.com/rstudio/gt.git","ssh_url":"git@github.com:rstudio/gt.git","clone_url":"https://github.com/rstudio/gt.git","svn_url":"https://github.com/rstudio/gt","homepage":"https://gt.rstudio.com","size":81037,"stargazers_count":741,"watchers_count":741,"language":"R","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":52,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":104,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":52,"open_issues":104,"watchers":741,"default_branch":"master"}},"base":{"label":"rstudio:master","ref":"master","sha":"876b862bb74f450991840946fde61face00c6cc4","user":{"login":"rstudio","id":513560,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUxMzU2MA==","avatar_url":"https://avatars1.githubusercontent.com/u/513560?v=4","gravatar_id":"","url":"https://api.github.com/users/rstudio","html_url":"https://github.com/rstudio","followers_url":"https://api.github.com/users/rstudio/followers","following_url":"https://api.github.com/users/rstudio/following{/other_user}","gists_url":"https://api.github.com/users/rstudio/gists{/gist_id}","starred_url":"https://api.github.com/users/rstudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstudio/subscriptions","organizations_url":"https://api.github.com/users/rstudio/orgs","repos_url":"https://api.github.com/users/rstudio/repos","events_url":"https://api.github.com/users/rstudio/events{/privacy}","received_events_url":"https://api.github.com/users/rstudio/received_events","type":"Organization","site_admin":false},"repo":{"id":126038547,"node_id":"MDEwOlJlcG9zaXRvcnkxMjYwMzg1NDc=","name":"gt","full_name":"rstudio/gt","private":false,"owner":{"login":"rstudio","id":513560,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUxMzU2MA==","avatar_url":"https://avatars1.githubusercontent.com/u/513560?v=4","gravatar_id":"","url":"https://api.github.com/users/rstudio","html_url":"https://github.com/rstudio","followers_url":"https://api.github.com/users/rstudio/followers","following_url":"https://api.github.com/users/rstudio/following{/other_user}","gists_url":"https://api.github.com/users/rstudio/gists{/gist_id}","starred_url":"https://api.github.com/users/rstudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstudio/subscriptions","organizations_url":"https://api.github.com/users/rstudio/orgs","repos_url":"https://api.github.com/users/rstudio/repos","events_url":"https://api.github.com/users/rstudio/events{/privacy}","received_events_url":"https://api.github.com/users/rstudio/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/rstudio/gt","description":"Easily generate information-rich, publication-quality tables from R","fork":false,"url":"https://api.github.com/repos/rstudio/gt","forks_url":"https://api.github.com/repos/rstudio/gt/forks","keys_url":"https://api.github.com/repos/rstudio/gt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rstudio/gt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rstudio/gt/teams","hooks_url":"https://api.github.com/repos/rstudio/gt/hooks","issue_events_url":"https://api.github.com/repos/rstudio/gt/issues/events{/number}","events_url":"https://api.github.com/repos/rstudio/gt/events","assignees_url":"https://api.github.com/repos/rstudio/gt/assignees{/user}","branches_url":"https://api.github.com/repos/rstudio/gt/branches{/branch}","tags_url":"https://api.github.com/repos/rstudio/gt/tags","blobs_url":"https://api.github.com/repos/rstudio/gt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rstudio/gt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rstudio/gt/git/refs{/sha}","trees_url":"https://api.github.com/repos/rstudio/gt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rstudio/gt/statuses/{sha}","languages_url":"https://api.github.com/repos/rstudio/gt/languages","stargazers_url":"https://api.github.com/repos/rstudio/gt/stargazers","contributors_url":"https://api.github.com/repos/rstudio/gt/contributors","subscribers_url":"https://api.github.com/repos/rstudio/gt/subscribers","subscription_url":"https://api.github.com/repos/rstudio/gt/subscription","commits_url":"https://api.github.com/repos/rstudio/gt/commits{/sha}","git_commits_url":"https://api.github.com/repos/rstudio/gt/git/commits{/sha}","comments_url":"https://api.github.com/repos/rstudio/gt/comments{/number}","issue_comment_url":"https://api.github.com/repos/rstudio/gt/issues/comments{/number}","contents_url":"https://api.github.com/repos/rstudio/gt/contents/{+path}","compare_url":"https://api.github.com/repos/rstudio/gt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rstudio/gt/merges","archive_url":"https://api.github.com/repos/rstudio/gt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rstudio/gt/downloads","issues_url":"https://api.github.com/repos/rstudio/gt/issues{/number}","pulls_url":"https://api.github.com/repos/rstudio/gt/pulls{/number}","milestones_url":"https://api.github.com/repos/rstudio/gt/milestones{/number}","notifications_url":"https://api.github.com/repos/rstudio/gt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rstudio/gt/labels{/name}","releases_url":"https://api.github.com/repos/rstudio/gt/releases{/id}","deployments_url":"https://api.github.com/repos/rstudio/gt/deployments","created_at":"2018-03-20T15:18:51Z","updated_at":"2019-04-05T08:52:31Z","pushed_at":"2019-04-05T14:41:02Z","git_url":"git://github.com/rstudio/gt.git","ssh_url":"git@github.com:rstudio/gt.git","clone_url":"https://github.com/rstudio/gt.git","svn_url":"https://github.com/rstudio/gt","homepage":"https://gt.rstudio.com","size":81037,"stargazers_count":741,"watchers_count":741,"language":"R","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":52,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":104,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":52,"open_issues":104,"watchers":741,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rstudio/gt/pulls/244"},"html":{"href":"https://github.com/rstudio/gt/pull/244"},"issue":{"href":"https://api.github.com/repos/rstudio/gt/issues/244"},"comments":{"href":"https://api.github.com/repos/rstudio/gt/issues/244/comments"},"review_comments":{"href":"https://api.github.com/repos/rstudio/gt/pulls/244/comments"},"review_comment":{"href":"https://api.github.com/repos/rstudio/gt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rstudio/gt/pulls/244/commits"},"statuses":{"href":"https://api.github.com/repos/rstudio/gt/statuses/e846841614fee9d875e583ab64238a5ee88a1609"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"rich-iannone"}}