This question is a variant of "How to print a long column from a dataframe splited in two columns side by side" that unfortunately had no answer.
I have a data frame with few columns and many rows that I would like to print in a single page. The following example is the just the beginning of my dataset.
structure(list(depnais = c("01", "02", "03", "04", "05", "06",
"07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17",
"18", "19", "21", "22", "23"), n = c(4051L, 5163L, 3323L,
1176L, 1394L, 12624L, 2623L, 2194L, 1227L, 3266L, 3111L, 2528L,
26737L, 7105L, 1096L, 3194L, 5173L, 2592L, 2323L, 5993L, 4952L,
571L)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-23L), .Names = c("depnais", "n"))
I would like to output its contents as :
# depnais n depnais n depnais n depnais n depnais n depnais n
# 1 01 4051 02 5163 03 3323 04 1176 05 1394 06 12624
# 2 07 2623 08 2194 09 1227 10 3266 11 3111 12 2528
# 3 13 26737 14 7105 15 1096 16 3194 17 5173 18 2592
# 4 19 2323 21 5993 22 4952 23 571
Today, I split my data frame into two parts : one with a number of rows that is a multiple of the number of splits (6 here) and another with the remainder of the rows, then I reorder the first part.
df %>% group_by(depnais) %>% summarise(n=n()) %>%
filter(depnais<'96') %>%
bind_cols(data.frame(g=rep(1:6,16))) %>%
replyr::replyr_split("g") %>%
purrr::reduce(bind_cols) %>% select(-matches("^g"))
And I print the two data frames separately.
But, actually I don't need the two data frames I make from the orginal one. So: is there a way to directly print the data frame, just specifying how many splits parts there should be?