r-lib / marquee

Markdown Parser and Renderer for R Graphics
https://marquee.r-lib.org
Other
85 stars 1 forks source link

Error in if (added_height > 0) { : the condition has length > 1 #18

Closed hrbrmstr closed 5 months ago

hrbrmstr commented 5 months ago

The R code @ the end errors out with:

Error in if (added_height > 0) { : the condition has length > 1

I disabled everything in .Rprofile and .Renviron.

It does not error out if I remove the markdown bullets.

library(marquee)
library(tidyverse)
library(hrbrthemes)

ggplot() +
  geom_marquee(
    data = mtcars |> rownames_to_column("car"),
    aes(
      wt, mpg, 
      label = sprintf(r"({.maroon %s} ![](/Users/hrbrmstr/Data/ghostie.png))", car)
    ),
    family = font_gs
  ) +
  labs( 
    title = r"(## Relationship Between *Car Weight* *& Miles Per Gallon* in {.blue 1974 Motor Trend} Cars"

**Dataset**  

The plot uses the `mtcars` 
dataset, which includes data on 32 cars 
from the {.blue 1974 Motor Trend} US magazine.

**Variables**  

- *Weight (wt)*: The weight of the car in 1,000 lbs.  
- *Miles Per Gallon (mpg)*: The fuel efficiency of the car measured in miles per gallon.

**Purpose**  

This scatter plot visualizes the relationship between the weight of the car and its fuel efficiency.

**Insights**:  

Generally, as the weight of the car increases, the miles per gallon decreases, indicating that heavier cars tend to be less fuel-efficient.

)") + 
  theme_ipsum_gs(grid="XY") +
  theme(plot.title = element_marquee(size = 9, width = 1, lineheight = 1.3))
thomasp85 commented 5 months ago

ouch, there was apparently some unforeseen possibilities in how tight lists might end up parsed. Thanks