{"action":"created","comment":{"url":"https://api.github.com/repos/tidyverse/ggplot2/pulls/comments/214921680","pull_request_review_id":152075348,"id":214921680,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDkyMTY4MA==","diff_hunk":"@@ -476,9 +476,20 @@ CoordSf <- ggproto(\"CoordSf\", CoordCartesian,\n     if (!is.null(graticule$plot12))\n       graticule$degree_label[!graticule$plot12] <- NA\n \n-    # parse labels into expressions if required\n-    if (any(grepl(\"degree\", graticule$degree_label)))\n-      graticule$degree_label <- lapply(graticule$degree_label, function(x) parse(text = x)[[1]])\n+    # Convert the string 'degree' to the degree symbol\n+    parse_ids <- grepl(\"\\\\bdegree\\\\b\", graticule$degree_label)\n+    if (any(parse_ids)) {\n+      graticule$degree_label <- Map(","path":"R/sf.R","position":10,"original_position":10,"commit_id":"8c798ee30b788f50f2078f4de665df74e90e463c","original_commit_id":"66c92342215e4d61e6a969f5b3ff1e5e6e381662","user":{"login":"clauswilke","id":4210929,"node_id":"MDQ6VXNlcjQyMTA5Mjk=","avatar_url":"https://avatars2.githubusercontent.com/u/4210929?v=4","gravatar_id":"","url":"https://api.github.com/users/clauswilke","html_url":"https://github.com/clauswilke","followers_url":"https://api.github.com/users/clauswilke/followers","following_url":"https://api.github.com/users/clauswilke/following{/other_user}","gists_url":"https://api.github.com/users/clauswilke/gists{/gist_id}","starred_url":"https://api.github.com/users/clauswilke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clauswilke/subscriptions","organizations_url":"https://api.github.com/users/clauswilke/orgs","repos_url":"https://api.github.com/users/clauswilke/repos","events_url":"https://api.github.com/users/clauswilke/events{/privacy}","received_events_url":"https://api.github.com/users/clauswilke/received_events","type":"User","site_admin":false},"body":"Not sure. It may be best to work with a full reprex. The following works:\r\n``` r\r\nparse_safe <- function(text) {\r\n  out <- vector(\"expression\", length(text))\r\n  for (i in seq_along(text)) {\r\n    expr <- parse(text = text[[i]])\r\n    out[[i]] <- if (length(expr) == 0) NA else expr[[1]]\r\n  }\r\n  out\r\n}\r\n\r\ngraticule <- data.frame(\r\n  type = c(\"E\", \"E\", \"E\", \"E\"),\r\n  degree_label = c(NA, \"abcd\", \"10 * degree * E\", \"15 * degree * E\"),\r\n  stringsAsFactors = FALSE\r\n)\r\n\r\nneeds_parsing <- grepl(\"degree\", graticule$degree_label)\r\nlabels <- as.list(graticule$degree_label)\r\nlabels[needs_parsing] <- lapply(labels[needs_parsing], function(x) parse(text = x)[[1]])\r\ngraticule$degree_label <- labels\r\ngraticule\r\n#>   type    degree_label\r\n#> 1    E              NA\r\n#> 2    E            abcd\r\n#> 3    E 10 * degree * E\r\n#> 4    E 15 * degree * E\r\n```\r\nDo you see a way to make it simpler?","created_at":"2018-09-04T13:51:42Z","updated_at":"2018-09-04T13:51:42Z","html_url":"https://github.com/tidyverse/ggplot2/pull/2867#discussion_r214921680","pull_request_url":"https://api.github.com/repos/tidyverse/ggplot2/pulls/2867","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/tidyverse/ggplot2/pulls/comments/214921680"},"html":{"href":"https://github.com/tidyverse/ggplot2/pull/2867#discussion_r214921680"},"pull_request":{"href":"https://api.github.com/repos/tidyverse/ggplot2/pulls/2867"}},"in_reply_to_id":214902167},"pull_request":{"url":"https://api.github.com/repos/tidyverse/ggplot2/pulls/2867","id":211480835,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExNDgwODM1","html_url":"https://github.com/tidyverse/ggplot2/pull/2867","diff_url":"https://github.com/tidyverse/ggplot2/pull/2867.diff","patch_url":"https://github.com/tidyverse/ggplot2/pull/2867.patch","issue_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2867","number":2867,"state":"open","locked":false,"title":"replace parse() with parse_safe() in geom_text()","user":{"login":"slowkow","id":209714,"node_id":"MDQ6VXNlcjIwOTcxNA==","avatar_url":"https://avatars2.githubusercontent.com/u/209714?v=4","gravatar_id":"","url":"https://api.github.com/users/slowkow","html_url":"https://github.com/slowkow","followers_url":"https://api.github.com/users/slowkow/followers","following_url":"https://api.github.com/users/slowkow/following{/other_user}","gists_url":"https://api.github.com/users/slowkow/gists{/gist_id}","starred_url":"https://api.github.com/users/slowkow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slowkow/subscriptions","organizations_url":"https://api.github.com/users/slowkow/orgs","repos_url":"https://api.github.com/users/slowkow/repos","events_url":"https://api.github.com/users/slowkow/events{/privacy}","received_events_url":"https://api.github.com/users/slowkow/received_events","type":"User","site_admin":false},"body":"The built in `parse()` function silently drops items:\r\n\r\n    length(parse(text = c(\"alpha\", \"\", \"gamma\")))\r\n\r\nWe expect the length to be 3, but instead it is 2.\r\n\r\nSo, we add a new function `parse_safe()` that keeps all items.\r\n\r\nThis addresses issue #2864","created_at":"2018-08-28T16:19:50Z","updated_at":"2018-09-04T13:51:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8dd56a4a723ec2d0f4c54218fa577f631498a853","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tidyverse/ggplot2/pulls/2867/commits","review_comments_url":"https://api.github.com/repos/tidyverse/ggplot2/pulls/2867/comments","review_comment_url":"https://api.github.com/repos/tidyverse/ggplot2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/2867/comments","statuses_url":"https://api.github.com/repos/tidyverse/ggplot2/statuses/8c798ee30b788f50f2078f4de665df74e90e463c","head":{"label":"slowkow:slowkow-parse","ref":"slowkow-parse","sha":"8c798ee30b788f50f2078f4de665df74e90e463c","user":{"login":"slowkow","id":209714,"node_id":"MDQ6VXNlcjIwOTcxNA==","avatar_url":"https://avatars2.githubusercontent.com/u/209714?v=4","gravatar_id":"","url":"https://api.github.com/users/slowkow","html_url":"https://github.com/slowkow","followers_url":"https://api.github.com/users/slowkow/followers","following_url":"https://api.github.com/users/slowkow/following{/other_user}","gists_url":"https://api.github.com/users/slowkow/gists{/gist_id}","starred_url":"https://api.github.com/users/slowkow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slowkow/subscriptions","organizations_url":"https://api.github.com/users/slowkow/orgs","repos_url":"https://api.github.com/users/slowkow/repos","events_url":"https://api.github.com/users/slowkow/events{/privacy}","received_events_url":"https://api.github.com/users/slowkow/received_events","type":"User","site_admin":false},"repo":{"id":120949651,"node_id":"MDEwOlJlcG9zaXRvcnkxMjA5NDk2NTE=","name":"ggplot2","full_name":"slowkow/ggplot2","owner":{"login":"slowkow","id":209714,"node_id":"MDQ6VXNlcjIwOTcxNA==","avatar_url":"https://avatars2.githubusercontent.com/u/209714?v=4","gravatar_id":"","url":"https://api.github.com/users/slowkow","html_url":"https://github.com/slowkow","followers_url":"https://api.github.com/users/slowkow/followers","following_url":"https://api.github.com/users/slowkow/following{/other_user}","gists_url":"https://api.github.com/users/slowkow/gists{/gist_id}","starred_url":"https://api.github.com/users/slowkow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slowkow/subscriptions","organizations_url":"https://api.github.com/users/slowkow/orgs","repos_url":"https://api.github.com/users/slowkow/repos","events_url":"https://api.github.com/users/slowkow/events{/privacy}","received_events_url":"https://api.github.com/users/slowkow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/slowkow/ggplot2","description":"An implementation of the Grammar of Graphics in R","fork":true,"url":"https://api.github.com/repos/slowkow/ggplot2","forks_url":"https://api.github.com/repos/slowkow/ggplot2/forks","keys_url":"https://api.github.com/repos/slowkow/ggplot2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slowkow/ggplot2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slowkow/ggplot2/teams","hooks_url":"https://api.github.com/repos/slowkow/ggplot2/hooks","issue_events_url":"https://api.github.com/repos/slowkow/ggplot2/issues/events{/number}","events_url":"https://api.github.com/repos/slowkow/ggplot2/events","assignees_url":"https://api.github.com/repos/slowkow/ggplot2/assignees{/user}","branches_url":"https://api.github.com/repos/slowkow/ggplot2/branches{/branch}","tags_url":"https://api.github.com/repos/slowkow/ggplot2/tags","blobs_url":"https://api.github.com/repos/slowkow/ggplot2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slowkow/ggplot2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slowkow/ggplot2/git/refs{/sha}","trees_url":"https://api.github.com/repos/slowkow/ggplot2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slowkow/ggplot2/statuses/{sha}","languages_url":"https://api.github.com/repos/slowkow/ggplot2/languages","stargazers_url":"https://api.github.com/repos/slowkow/ggplot2/stargazers","contributors_url":"https://api.github.com/repos/slowkow/ggplot2/contributors","subscribers_url":"https://api.github.com/repos/slowkow/ggplot2/subscribers","subscription_url":"https://api.github.com/repos/slowkow/ggplot2/subscription","commits_url":"https://api.github.com/repos/slowkow/ggplot2/commits{/sha}","git_commits_url":"https://api.github.com/repos/slowkow/ggplot2/git/commits{/sha}","comments_url":"https://api.github.com/repos/slowkow/ggplot2/comments{/number}","issue_comment_url":"https://api.github.com/repos/slowkow/ggplot2/issues/comments{/number}","contents_url":"https://api.github.com/repos/slowkow/ggplot2/contents/{+path}","compare_url":"https://api.github.com/repos/slowkow/ggplot2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slowkow/ggplot2/merges","archive_url":"https://api.github.com/repos/slowkow/ggplot2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slowkow/ggplot2/downloads","issues_url":"https://api.github.com/repos/slowkow/ggplot2/issues{/number}","pulls_url":"https://api.github.com/repos/slowkow/ggplot2/pulls{/number}","milestones_url":"https://api.github.com/repos/slowkow/ggplot2/milestones{/number}","notifications_url":"https://api.github.com/repos/slowkow/ggplot2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slowkow/ggplot2/labels{/name}","releases_url":"https://api.github.com/repos/slowkow/ggplot2/releases{/id}","deployments_url":"https://api.github.com/repos/slowkow/ggplot2/deployments","created_at":"2018-02-09T19:59:44Z","updated_at":"2018-08-28T14:50:09Z","pushed_at":"2018-09-04T13:02:35Z","git_url":"git://github.com/slowkow/ggplot2.git","ssh_url":"git@github.com:slowkow/ggplot2.git","clone_url":"https://github.com/slowkow/ggplot2.git","svn_url":"https://github.com/slowkow/ggplot2","homepage":"http://ggplot2.tidyverse.org","size":32644,"stargazers_count":0,"watchers_count":0,"language":"R","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tidyverse:master","ref":"master","sha":"6e545dc4746085d87382a828e45b0f7e58a7578f","user":{"login":"tidyverse","id":22032646,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMDMyNjQ2","avatar_url":"https://avatars2.githubusercontent.com/u/22032646?v=4","gravatar_id":"","url":"https://api.github.com/users/tidyverse","html_url":"https://github.com/tidyverse","followers_url":"https://api.github.com/users/tidyverse/followers","following_url":"https://api.github.com/users/tidyverse/following{/other_user}","gists_url":"https://api.github.com/users/tidyverse/gists{/gist_id}","starred_url":"https://api.github.com/users/tidyverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidyverse/subscriptions","organizations_url":"https://api.github.com/users/tidyverse/orgs","repos_url":"https://api.github.com/users/tidyverse/repos","events_url":"https://api.github.com/users/tidyverse/events{/privacy}","received_events_url":"https://api.github.com/users/tidyverse/received_events","type":"Organization","site_admin":false},"repo":{"id":19438,"node_id":"MDEwOlJlcG9zaXRvcnkxOTQzOA==","name":"ggplot2","full_name":"tidyverse/ggplot2","owner":{"login":"tidyverse","id":22032646,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyMDMyNjQ2","avatar_url":"https://avatars2.githubusercontent.com/u/22032646?v=4","gravatar_id":"","url":"https://api.github.com/users/tidyverse","html_url":"https://github.com/tidyverse","followers_url":"https://api.github.com/users/tidyverse/followers","following_url":"https://api.github.com/users/tidyverse/following{/other_user}","gists_url":"https://api.github.com/users/tidyverse/gists{/gist_id}","starred_url":"https://api.github.com/users/tidyverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidyverse/subscriptions","organizations_url":"https://api.github.com/users/tidyverse/orgs","repos_url":"https://api.github.com/users/tidyverse/repos","events_url":"https://api.github.com/users/tidyverse/events{/privacy}","received_events_url":"https://api.github.com/users/tidyverse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidyverse/ggplot2","description":"An implementation of the Grammar of Graphics in R","fork":false,"url":"https://api.github.com/repos/tidyverse/ggplot2","forks_url":"https://api.github.com/repos/tidyverse/ggplot2/forks","keys_url":"https://api.github.com/repos/tidyverse/ggplot2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidyverse/ggplot2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidyverse/ggplot2/teams","hooks_url":"https://api.github.com/repos/tidyverse/ggplot2/hooks","issue_events_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/events{/number}","events_url":"https://api.github.com/repos/tidyverse/ggplot2/events","assignees_url":"https://api.github.com/repos/tidyverse/ggplot2/assignees{/user}","branches_url":"https://api.github.com/repos/tidyverse/ggplot2/branches{/branch}","tags_url":"https://api.github.com/repos/tidyverse/ggplot2/tags","blobs_url":"https://api.github.com/repos/tidyverse/ggplot2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidyverse/ggplot2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidyverse/ggplot2/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidyverse/ggplot2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidyverse/ggplot2/statuses/{sha}","languages_url":"https://api.github.com/repos/tidyverse/ggplot2/languages","stargazers_url":"https://api.github.com/repos/tidyverse/ggplot2/stargazers","contributors_url":"https://api.github.com/repos/tidyverse/ggplot2/contributors","subscribers_url":"https://api.github.com/repos/tidyverse/ggplot2/subscribers","subscription_url":"https://api.github.com/repos/tidyverse/ggplot2/subscription","commits_url":"https://api.github.com/repos/tidyverse/ggplot2/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidyverse/ggplot2/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidyverse/ggplot2/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidyverse/ggplot2/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidyverse/ggplot2/contents/{+path}","compare_url":"https://api.github.com/repos/tidyverse/ggplot2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidyverse/ggplot2/merges","archive_url":"https://api.github.com/repos/tidyverse/ggplot2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidyverse/ggplot2/downloads","issues_url":"https://api.github.com/repos/tidyverse/ggplot2/issues{/number}","pulls_url":"https://api.github.com/repos/tidyverse/ggplot2/pulls{/number}","milestones_url":"https://api.github.com/repos/tidyverse/ggplot2/milestones{/number}","notifications_url":"https://api.github.com/repos/tidyverse/ggplot2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidyverse/ggplot2/labels{/name}","releases_url":"https://api.github.com/repos/tidyverse/ggplot2/releases{/id}","deployments_url":"https://api.github.com/repos/tidyverse/ggplot2/deployments","created_at":"2008-05-25T01:21:32Z","updated_at":"2018-09-04T13:31:35Z","pushed_at":"2018-09-04T13:02:39Z","git_url":"git://github.com/tidyverse/ggplot2.git","ssh_url":"git@github.com:tidyverse/ggplot2.git","clone_url":"https://github.com/tidyverse/ggplot2.git","svn_url":"https://github.com/tidyverse/ggplot2","homepage":"http://ggplot2.tidyverse.org","size":32505,"stargazers_count":3311,"watchers_count":3311,"language":"R","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1235,"mirror_url":null,"archived":false,"open_issues_count":117,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":1235,"open_issues":117,"watchers":3311,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tidyverse/ggplot2/pulls/2867"},"html":{"href":"https://github.com/tidyverse/ggplot2/pull/2867"},"issue":{"href":"https://api.github.com/repos/tidyverse/ggplot2/issues/2867"},"comments":{"href":"https://api.github.com/repos/tidyverse/ggplot2/issues/2867/comments"},"review_comments":{"href":"https://api.github.com/repos/tidyverse/ggplot2/pulls/2867/comments"},"review_comment":{"href":"https://api.github.com/repos/tidyverse/ggplot2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tidyverse/ggplot2/pulls/2867/commits"},"statuses":{"href":"https://api.github.com/repos/tidyverse/ggplot2/statuses/8c798ee30b788f50f2078f4de665df74e90e463c"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"clauswilke"}}