Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment in expressions #108

Open
gadenbuie opened this issue Aug 14, 2023 · 0 comments
Open

Assignment in expressions #108

gadenbuie opened this issue Aug 14, 2023 · 0 comments

Comments

@gadenbuie
Copy link
Owner

This might be a glue thing, but assigning to a variable in the global environment works except when the value comes from the glue environment.

When the variable exists in the global env and the value is inlined:

x <- 0
null <- epoxy("{x <- 99}")
x
#> [1] 99

null <- epoxy_html("{{ x <- 404 }}")
x
#> [1] 404

null <- epoxy_latex("<< x <- 'knuth' >>", .open = "<<", .close = ">>")
x
#> [1] "knuth"

but when the value comes from the glue calling args:

x <- 0
null <- epoxy("{x <- v}", v = 99)
x
#> [1] 0

null <- epoxy_html("{{ x <- v }}", v = 404)
x
#> [1] 0

null <- epoxy_latex("<< x <- v >>", v = "knuth", .open = "<<", .close = ">>")
x
#> [1] 0

This happens in glue, too.

x <- 0
null <- glue::glue("{x <- v}", v = 99)
x
#> [1] 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant