Learn R Programming

rlist (version 0.2.2)

list.update: Update a list by modifying its elements.

Description

Update a list by modifying its elements.

Usage

list.update(.data, ..., keep.null = FALSE)

Arguments

.data
list
...
A group of labmda expressions
keep.null
Should NULL values be preserved for modifyList

Examples

Run this code
x <- list(p1 = list(type="A",score=list(c1=10,c2=8)),
       p2 = list(type="B",score=list(c1=9,c2=9)),
       p3 = list(type="B",score=list(c1=9,c2=7)))
list.update(x,high=max(score$c1,score$c2),low=min(score$c1,score$c2))
list.update(x,exams=length(score))
list.update(x,grade=ifelse(type=="A",score$c1,score$c2))
list.update(x,score=list(min=0,max=10))

Run the code above in your browser using DataLab