'Formatted multilinestring with glue::glue (in geom_richtext)

I am having some issues creating a multilinestring with the glue::glue function. I am reading here (https://cran.r-project.org/web/packages/glue/readme/README.html). That it should look more or less like this:

glue::glue("
           The
              indented multilinestring goes here
           ")

So I am doing this:

  geom_text(
    data = data,
    aes(
      x = xend,
      y = yend + 1000,
      label = glue::glue("
                          {name}
                            **{round(mean_value, 0)}** € /qm
                         ")), 
    hjust=-.3,
    size = 5,
    family = "Times"
  ) 

But for some reason it does not terminate the call to ggplot. In the r-console the little + sign does not disappear as something seems to be wrong.

When I move the opening " to a new like like this:

  geom_text(
    data = data,
    aes(
      x = xend,
      y = yend + 1000,
      label = glue::glue(
      "
                          {name}
                            **{round(mean_value, 0)}** € /qm
      ")), 
    hjust=-.3,
    size = 5,
    family = "Times"
  ) 

It works!

This however stops working when I use this inside a geom_richtext instead of a geom_text.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source