list.iter: Iterate a list by evaluating an expression on each list...

Description Usage Arguments Value Examples

View source: R/list.map.R

Description

Iterate a list by evaluating an expression on each list element

Usage

1
list.iter(.data, expr)

Arguments

.data

list

expr

A lambda expression

Value

invisible(.data)

Examples

1
2
3
4
5
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.iter(x,cat(paste(type,'\n')))
list.iter(x,cat(str(.)))

Example output

A 
B 
B 
List of 2
 $ type : chr "A"
 $ score:List of 2
  ..$ c1: num 10
  ..$ c2: num 8
List of 2
 $ type : chr "B"
 $ score:List of 2
  ..$ c1: num 9
  ..$ c2: num 9
List of 2
 $ type : chr "B"
 $ score:List of 2
  ..$ c1: num 9
  ..$ c2: num 7

rlist documentation built on Sept. 5, 2021, 5:30 p.m.