The behaviour of 'print' appears to have changed in the latest version of R studio - 2026.01.0 Build 392. In every earlier version I have used, if I ran the code below
my_df <- data.frame(
Name = c("Alice", "Bob", "Charlie"),
Age = c(25, 30, 22),
Working = c(TRUE, FALSE, TRUE)
)
View the result
print(my_df)
my_df
I would end up with two neatly formatted versions of the df.
But in the latest version, the command print(my_df) will return the df formatted as a matrix (or a list if only one column), while the command my_df will return a nicely formatted df.
I have written a number of programs that assumed that print(df) will return a nicely formatted table....
What I posted was from an R script. From an Rmd document, I get what you posted: a choice between "R Console" output, which matches my earlier answer, and "data.frame", which matches what you show above.
So we agree then on outcomes. Prior to the latest version of R studio, both outputs from an RMD file were in the 'data.frame' output. Sorry if I was unclear - I was not sure what the correct terminology was.
(#16483): Changed R Markdown / Quarto documents to only use paged-table view for auto-printed data objects
Kind of hacky and rather fragile workaround or more like a proof of concept would be overriding print.data.frame() (and/or print methods for other data-objects you use, e.g. tibbles) in your Rmd to call rmarkdown::paged_table():
This can break in quite a few ways so be careful and as a bare minimum, you might want to include some error handling and recovery logic. print() should also invisibly return its first argument, so if any of your code relies on that (mine often does), that's another issue you'd need address / be aware of.
Thank for you that!. Where the change affects me most is that I sometimes use the print command within a function to show a curated set of results. A workaround I used yesterday is to replace print(df) with return(df) - I know, it is not the same thing...
Since the change appears to be deliberate and not an unintended consequence, I guess I have to live with it. I will save your suggested code in my standard list of functions, and use it when required.