Learn R Programming

largeList (version 0.3.1)

readList: Get elements from a list file.

Description

Get elements from a list file.

Usage

readList(file, index = NULL)

Arguments

file
Name of file.
index
NULL or a numeric, character, logical vector.

Value

A list object.

Details

If no indices provided, the whole list will be read. Given index could be a numeric (integer) vector, a logical vector or a character vector representing the names. If there exist more then one elements corresponding to a given name, the first matched will be returned (not necessary to be the first one in index order). If there are no elements with given name, NULL will be returned. Files created by saveRDS can't be read. When it takes long time to process, some verbose info will be printed to console, which can be switched off by setting options(list(largeList.report.progress = FALSE)).

See Also

largeList

Examples

Run this code
list_1 <- list("A" = c(1,2), "B" = "abc", list(1, 2, 3))
saveList(object = list_1, file = "example.llo")

# read the whole list
readList(file = "example.llo")

# by numeric indices
readList(file = "example.llo", index = c(1, 3))

# by names
readList(file = "example.llo", index = c("A", "B"))

# by logical indices
readList(file = "example.llo", index = c(TRUE, FALSE, TRUE))

Run the code above in your browser using DataLab