chunk_reader | R Documentation |
This function creates a reader to read a text file in batches (or chunks). It can be used for very large files that cannot fit in RAM.
chunk_reader(file_path)
file_path |
path to large file |
a list-object containing the function 'read' to read lines from the given file, and 'close' to close the connection to the file stream.
# open connection to file reader <- chunk_reader( system.file("extdata", "paac_jhu_2014_500.maf", package = "CIMICE", mustWork = TRUE) ) while(TRUE){ # read a chunk chunk <- reader$read(10) if(length(chunk) == 0){ break } # --- process chunk --- } # close connection reader$close()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.