Skip to content

Assignment in expressions #108

@gadenbuie

Description

@gadenbuie

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions