Paging shows a slice of rows while preserving the full table in memory.

Program

Play the script to change the page size and see the second-page window move.

table_paging.R
rows <- paste0("row", 1:8)
page_size <- 
start <- page_size + 1
end <- min(length(rows), page_size * 2)
visible <- rows[start:end]
label <- paste(visible, collapse = ",")
cat(label, "\n", sep = "")
rows <- paste0("row", 1:8)
page_size <- 
start <- page_size + 1
end <- min(length(rows), page_size * 2)
visible <- rows[start:end]
label <- paste(visible, collapse = ",")
cat(label, "\n", sep = "")
rows <- paste0("row", 1:8)
page_size <- 
start <- page_size + 1
end <- min(length(rows), page_size * 2)
visible <- rows[start:end]
label <- paste(visible, collapse = ",")
cat(label, "\n", sep = "")
page size `page_size` controls how many rows appear in one window.
window bounds `start` and `end` identify the visible row positions.
slice `rows[start:end]` selects only the current page.