Repository navigation
Closed
Description
System details
RStudio Edition : 2023.08.0-daily+60
RStudio Version : Desktop [Open Source]
OS Version : macOS Ventura 13.5
R Version : R version 4.3.1 (2023-06-16)
Steps to reproduce the problem
From thomasp85/patchwork#231.
library(ggplot2)
library(patchwork)
gg1 <- ggplot(mtcars, aes(mpg, cyl)) +
geom_point()
gg2 <- ggplot(mtcars, aes(hp, disp)) +
geom_point()
foo <- gg1 + gg2 + plot_layout(ncol = 1)
Describe the problem in detail
A data.frame is printed, which is not expected.
Describe the behavior you expected
There shouldn't be any chunk outputs after executing this code.
Session Info
Tracing print(rInfo) on entry
[1] "hi"
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.5
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
Tracing print(strsplit(x$locale, ";", fixed = TRUE)[[1]], quote = FALSE, .... on entry
[1] "hi"
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Los_Angeles
tzcode source: internal
attached base packages:
Tracing print(x$basePkgs, quote = FALSE, ...) on entry
[1] "hi"
[1] stats graphics grDevices utils datasets methods base
other attached packages:
Tracing print(mkLabel(x, "otherPkgs"), quote = FALSE, ...) on entry
[1] "hi"
[1] patchwork_1.1.2 ggplot2_3.4.2
loaded via a namespace (and not attached):
Tracing print(mkLabel(x, "loadedOnly"), quote = FALSE, ...) on entry
[1] "hi"
[1] vctrs_0.6.3 cli_3.6.1 knitr_1.43 rlang_1.1.1.9000
[5] xfun_0.39 DBI_1.1.3 generics_0.1.3 textshaping_0.3.6
[9] labeling_0.4.2 glue_1.6.2 colorspace_2.1-0 htmltools_0.5.5
[13] ragg_1.2.5 scales_1.2.1 fansi_1.0.4 rmarkdown_2.23
[17] grid_4.3.1 evaluate_0.21 munsell_0.5.0 tibble_3.2.1
[21] fastmap_1.1.1 yaml_2.3.7 lifecycle_1.0.3 compiler_4.3.1
[25] dplyr_1.1.2 pkgconfig_2.0.3 rstudioapi_0.15.0 farver_2.1.1
[29] systemfonts_1.0.4 digest_0.6.33 R6_2.5.1 tidyselect_1.2.0
[33] utf8_1.2.3 pillar_1.9.0 magrittr_2.0.3 withr_2.5.0
[37] tools_4.3.1 gtable_0.3.3 Reacted by Jan Gleixner and David F. Severski
Activity
kevinushey commentedon Aug 8, 2023
I've taken a look, and it looks like a bug in RStudio. To explain the behavior:
print()overrides, so that it can detect and capture attempts to print R objects. This is what allows RStudio to capture e.g.data.frameprint-outs in a clean way.fooobject, we callstr(foo)-- but this involves callingprint()when examining some of the internal data infoo.print()overrides in (1) are still active, we end up inadvertently capturing that output into the Notebook chunk.I think we can fix this on the RStudio side by making sure we deactivate our print overrides when updating the Environment pane.
kevinushey commentedon Aug 8, 2023
rstudio/src/cpp/session/modules/NotebookData.R
Lines 16 to 60 in f369336
bshor commentedon May 29, 2025
I still see this error in patchwork. But it goes away if I simply do
plot1 + plot2
Instead of assigning that to an object and printing the object.
AlbertoFabbri93 commentedon Aug 7, 2025
I am experiencing the same problem with the
DimPlot()function from the Seurat package:If I do not assign the plot to a variable the data.frame is not printed.
ronblum commentedon Aug 11, 2025
Note: This is only an issue when running chunks--not an issue when knitting the file.
ronblum commentedon Sep 17, 2025
Verified in RStudio Desktop 2025.11.0-daily+146 on Windows 11. Also made sure that if the objects are added to the end of the chunk, they show up in the output.
complete BRAT to Playwright migration (#17713)
test(e2e): wait on R busy/idle for output-less chunks, not a racy marker
stabilize pane-layout e2e tests and fix sidebar zero-width squeeze (#…