Memory-map text files of characters.
install.packages("mmapcharr")
As inputs, package mmapcharr uses text files of characters separated by another character. Lines should be the same so that the file can be viewed as a matrix. Files should end up with an empty line.
You can play with the code parameter to access whatever you want instead of characters (see the example code below).

You can access files in such shape the same way as for R(cpp) matrices.
library(mmapcharr)
test_file <- system.file("testdata/test-windows.txt", package = "mmapcharr")
readLines(test_file)
# Create the memory-mapping object based on the text file
test <- mmapchar(test_file, code = mmapcharr:::CODE_012)
test[]
test[, 1:10]
# Underlying characters
(CHAR256 <- rawToChar(as.raw(0:255), multiple = TRUE))
# Change the code to access true characters
test2 <- test$copy(code = CHAR256)
test2[, 1:10]
# Change the code to access logicals (why not?)
test3 <- test$copy(code = rep(c(TRUE, FALSE), 256 / 2))
test3[, 1:10]
Please open an issue if you find a bug.