This document include a list of examples using rlist
together with pipeR
.
library(rlist)
library(pipeR)
set.seed(100)
srcData <- rnorm(1000)
1:5 %>>%
list.map(sample(srcData,10)) %>>%
list.select(mean=mean(.),median=median(.)) %>>%
list.stack
# mean median
# 1 0.14381 0.24374
# 2 0.33333 0.22613
# 3 -0.40609 -0.42289
# 4 -0.29127 -0.22574
# 5 -0.07143 0.09998
students <- '
A:
s1:
name: Ken
age: 25
s2:
name: James
age: 23
B:
s3:
name: Peter
age: 25
s4:
name: Josh
age: 24
'
students %>>%
list.parse(type="yaml") %>>%
list.map(f(members,,clsname) -> members %>>% list.update(class=clsname)) %>>%
list.ungroup %>>%
list.stack
# name age class
# 1 Ken 25 A
# 2 James 23 A
# 3 Peter 25 B
# 4 Josh 24 B