I have a table, using gt at the moment, that is too long (too many rows) to be displayed easily. If there a not too difficult way of displaying the table in two or three side-by-side columns?
Here is a brute strength and stupidity approach. You can do the same thing with a data.frame or a tibble, I just prefer a data.table.
library(data.table)
library(gt)
# Create mock data set --------------------------------------------------------
DT <- data.table(aa = 1:40, bb = 40:1)
# Split data and recombine -----------------------------------------------
DT1 <- DT[1:20]
DT2 <- DT[21:40]
DT3 <- cbind(DT1, DT2)
# Rename to remove duplicate names ----------------------------------------
names(DT3) <- c("aa", "bb", "cc" ,"dd" )
# Generate Table & Relabel----------------------------------------------------------
DT3 |> gt() |> cols_label(aa = "AA", bb = "BB", cc = "AA", dd = "BB" )
2 Likes
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.