{"action":"created","issue":{"url":"https://api.github.com/repos/tidyverse/glue/issues/89","repository_url":"https://api.github.com/repos/tidyverse/glue","labels_url":"https://api.github.com/repos/tidyverse/glue/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/tidyverse/glue/issues/89/comments","events_url":"https://api.github.com/repos/tidyverse/glue/issues/89/events","html_url":"https://github.com/tidyverse/glue/issues/89","id":315660468,"number":89,"title":"Passing named arguments using assigned objects","user":{"login":"dchiu911","id":8665632,"avatar_url":"https://avatars3.githubusercontent.com/u/8665632?v=4","gravatar_id":"","url":"https://api.github.com/users/dchiu911","html_url":"https://github.com/dchiu911","followers_url":"https://api.github.com/users/dchiu911/followers","following_url":"https://api.github.com/users/dchiu911/following{/other_user}","gists_url":"https://api.github.com/users/dchiu911/gists{/gist_id}","starred_url":"https://api.github.com/users/dchiu911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dchiu911/subscriptions","organizations_url":"https://api.github.com/users/dchiu911/orgs","repos_url":"https://api.github.com/users/dchiu911/repos","events_url":"https://api.github.com/users/dchiu911/events{/privacy}","received_events_url":"https://api.github.com/users/dchiu911/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-04-18T22:13:18Z","updated_at":"2018-04-19T13:35:44Z","closed_at":null,"author_association":"NONE","body":"I can't seem to pass named arguments to `glue` when the values are assigned to objects with the same name as the interpolations:\r\n```r\r\n# Example from ?glue\r\nglue('My name is {name},',\r\n     ' my age next year is {age + 1},',\r\n     ' my anniversary is {format(anniversary, \"%A, %B %d, %Y\")}.',\r\n     name = \"Joe\",\r\n     age = 40,\r\n     anniversary = as.Date(\"2001-10-12\"))\r\n# My name is Joe, my age next year is 41, my anniversary is Friday, October 12, 2001.\r\n\r\n# Passing named arguments using different names\r\nnm <- \"Joe\"\r\nag <- 40\r\nan <- as.Date(\"2001-10-12\")\r\nglue('My name is {name},',\r\n     ' my age next year is {age + 1},',\r\n     ' my anniversary is {format(anniversary, \"%A, %B %d, %Y\")}.',\r\n     name = nm,\r\n     age = ag,\r\n     anniversary = an)\r\n# My name is Joe, my age next year is 41, my anniversary is Friday, October 12, 2001.\r\n\r\n# Passing named arguments using same names\r\nname <- \"Joe\"\r\nage <- 40\r\nanniversary <- as.Date(\"2001-10-12\")\r\nglue('My name is {name},',\r\n     ' my age next year is {age + 1},',\r\n     ' my anniversary is {format(anniversary, \"%A, %B %d, %Y\")}.',\r\n     name = name,\r\n     age = age,\r\n     anniversary = anniversary)\r\n# Error in eval(parse(text = text, keep.source = FALSE), envir) : \r\n#   promise already under evaluation: recursive default argument reference or earlier problems?\r\n```"},"comment":{"url":"https://api.github.com/repos/tidyverse/glue/issues/comments/382737911","html_url":"https://github.com/tidyverse/glue/issues/89#issuecomment-382737911","issue_url":"https://api.github.com/repos/tidyverse/glue/issues/89","id":382737911,"user":{"login":"jimhester","id":205275,"avatar_url":"https://avatars3.githubusercontent.com/u/205275?v=4","gravatar_id":"","url":"https://api.github.com/users/jimhester","html_url":"https://github.com/jimhester","followers_url":"https://api.github.com/users/jimhester/followers","following_url":"https://api.github.com/users/jimhester/following{/other_user}","gists_url":"https://api.github.com/users/jimhester/gists{/gist_id}","starred_url":"https://api.github.com/users/jimhester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimhester/subscriptions","organizations_url":"https://api.github.com/users/jimhester/orgs","repos_url":"https://api.github.com/users/jimhester/repos","events_url":"https://api.github.com/users/jimhester/events{/privacy}","received_events_url":"https://api.github.com/users/jimhester/received_events","type":"User","site_admin":false},"created_at":"2018-04-19T13:35:44Z","updated_at":"2018-04-19T13:35:44Z","author_association":"OWNER","body":"@egnha, that is a good point\r\n\r\n```r\r\nx <- 1\r\nglue::glue(\"{x}\", x = x + 1)\r\n```\r\nShould definitely work, and currently does not, so we will need to do something like #90."}}
{"actor":{"display_login":"jimhester"}}