readList: Get elements from a list file.

Description Usage Arguments Details Value See Also Examples

View source: R/Exports.R

Description

Get elements from a list file.

Usage

1
readList(file, index = NULL)

Arguments

file

Name of file.

index

NULL or a numeric, character, logical vector.

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)).

Value

A list object.

See Also

largeList

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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))

largeList documentation built on May 1, 2019, 10:55 p.m.