### Bug description

Sorry for the weird issue title.
If I try to add `lines()` or `points()` to a plot when looping in a `data.table` (using argument `by`), only the last "by call" shows up in the output figure. E.g. if the following code is rendered in a simple quarto document, only 1 line (lab == 'd') is showing instead of 4 lines:

````qmd
---
format: pdf
---

```{r}
#| label: fig-example
#| fig-cap: "Only showing 1 line"
#| fig-asp: 1
#| fig-width: 3
library(data.table, quietly = TRUE)
Nlab <- 4
dt <- data.table(
    lab = rep(letters[1:Nlab], each = 2),
    x =  runif(Nlab * 2, -200, 100), y = runif(Nlab * 2, -200, 100))
plot(1, type = 'n', xlim = c(-200, 100), ylim = c(-200, 100))
invisible(dt[, {
    points(x, y, pch = 20)
    lines(x, y)
}, by = lab])
dt
```
````

My quarto version is 1.2.242.

I'm running R in a terminal, not in R Studio, on Debian 11.

My `sessionInfo()`:

```r
R version 4.2.1 (2022-06-23)                                                                                                                                                                                         
Platform: x86_64-pc-linux-gnu (64-bit)                                                                                                                                                                               
Running under: Progress Linux 6.99 (fuchur-backports)                                                                                                                                                                
                                                                                                                                                                                                                     
Matrix products: default                                                                                                                                                                                             
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0                                                                                                                                                              
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0                                                                                                                                                          
                                                                                                                                                                                                                     
locale:                                                                                                                                                                                                              
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8                          
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C                                                                                 
                                                                                                                                                                                                                     
attached base packages:                                                                                                                                                                                              
[1] stats     graphics  grDevices utils     datasets  methods   base                                                                                                                                                 
                                                                                                                                                                                                                     
other attached packages:                                                                                                                                                                                             
[1] data.table_1.14.2 colorout_1.2-2                                                                                                                                                                                 
                                                                                                                                                                                                                     
loaded via a namespace (and not attached):                                                                                                                                                                           
 [1] Rcpp_1.0.9             ps_1.7.1               RhpcBLASctl_0.21-247.1 digest_0.6.29          later_1.3.0            R6_2.5.1               jsonlite_1.8.0         evaluate_0.16          rlang_1.0.4             
[10] cli_3.3.0              rstudioapi_0.14        rmarkdown_2.16         tools_4.2.1            glue_1.6.2             yaml_2.3.5             xfun_0.32              fastmap_1.1.0          compiler_4.2.1          
[19] processx_3.7.0         htmltools_0.5.3        knitr_1.40             quarto_1.2 
```


### Checklist

- [ ] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [ ] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [ ] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [ ] Please document the operating system you're running. If on Linux, please provide the specific distribution.
cderv
2022-10-25T15:07:55Z
ChHaeni
bug
closed
'by'-looping over data.table: only last 'by'-call to points()/lines() shows in output
https://github.com/quarto-dev/quarto-cli/issues/3029