library(ripe)
stats::runif(20)%>%
ripe(replicate,n=2,simplify=FALSE)
#> [[1]]
#> [1] 0.88953932 0.69280341 0.64050681 0.99426978 0.65570580 0.70853047
#> [7] 0.54406602 0.59414202 0.28915974 0.14711365 0.96302423 0.90229905
#> [13] 0.69070528 0.79546742 0.02461368 0.47779597 0.75845954 0.21640794
#> [19] 0.31818101 0.23162579
#>
#> [[2]]
#> [1] 0.14280002 0.41454634 0.41372433 0.36884545 0.15244475 0.13880606
#> [7] 0.23303410 0.46596245 0.26597264 0.85782772 0.04583117 0.44220007
#> [13] 0.79892485 0.12189926 0.56094798 0.20653139 0.12753165 0.75330786
#> [19] 0.89504536 0.37446278
stats::runif(20)%>%
sample(10)%>%
ripe(replicate,n=3,simplify=FALSE)
#> [[1]]
#> [1] 0.60873498 0.78229430 0.94772694 0.59998896 0.06072057 0.93529980
#> [7] 0.51150546 0.95447383 0.46677904 0.89035022
#>
#> [[2]]
#> [1] 0.24572368 0.84272932 0.23909996 0.31170220 0.82180546 0.01046711
#> [7] 0.23116178 0.43943154 0.65983845 0.18384952
#>
#> [[3]]
#> [1] 0.6180179 0.7465680 0.4127461 0.7082903 0.5817501 0.2656867 0.6682846
#> [8] 0.6299731 0.4812898 0.2650178
stats::runif(20)%>%
sample(10)%>%
utils::head(5)%>%
ripe(replicate,n=4,simplify=FALSE)
#> [[1]]
#> [1] 0.1716985 0.5468262 0.5930457 0.6330554 0.6623176
#>
#> [[2]]
#> [1] 0.97187564 0.22588643 0.07205712 0.13710608 0.05795856
#>
#> [[3]]
#> [1] 0.1566369 0.6301319 0.8028123 0.7790659 0.7293907
#>
#> [[4]]
#> [1] 0.5260297 0.1194048 0.5150718 0.9674695 0.4925665
stats::runif(20)%>%
sample(10)%>%
utils::head(5)%>%
ripe(lapply, X=1:4)
#> [[1]]
#> [1] 0.32172554 0.08250275 0.59626354 0.62625695 0.02799257
#>
#> [[2]]
#> [1] 0.2366197 0.7603995 0.7085741 0.3580570 0.1611658
#>
#> [[3]]
#> [1] 0.11577966 0.21516649 0.09391661 0.67822386 0.68774269
#>
#> [[4]]
#> [1] 0.7358994 0.4547616 0.7702048 0.3956606 0.5039487
(ncores <- parallel::detectCores())
#> [1] 4
stats::runif(20)%>%
sample(10)%>%
utils::head(5)%>%
ripe(parallel::mclapply, X=1:4, mc.cores = pmin(1,ncores-1))
#> [[1]]
#> [1] 0.87394991 0.15133817 0.01836408 0.94958532 0.41330541
#>
#> [[2]]
#> [1] 0.02199372 0.04210805 0.99304478 0.78182307 0.62974542
#>
#> [[3]]
#> [1] 0.5029083 0.6145622 0.9091465 0.7456362 0.4757505
#>
#> [[4]]
#> [1] 0.4204349 0.5395609 0.7337478 0.5223358 0.7147548
iris %>%
dplyr::sample_n(5) %>%
ripe(purrr::rerun,.n=3)
#> [[1]]
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.2 2.7 3.9 1.4 versicolor
#> 2 5.4 3.9 1.3 0.4 setosa
#> 3 4.6 3.6 1.0 0.2 setosa
#> 4 5.1 3.8 1.9 0.4 setosa
#> 5 7.7 3.0 6.1 2.3 virginica
#>
#> [[2]]
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 6.0 2.9 4.5 1.5 versicolor
#> 2 5.6 3.0 4.5 1.5 versicolor
#> 3 4.4 3.0 1.3 0.2 setosa
#> 4 5.2 3.5 1.5 0.2 setosa
#> 5 6.7 3.1 4.7 1.5 versicolor
#>
#> [[3]]
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1 5.8 2.7 5.1 1.9 virginica
#> 2 6.4 3.1 5.5 1.8 virginica
#> 3 6.7 2.5 5.8 1.8 virginica
#> 4 5.9 3.0 5.1 1.8 virginica
#> 5 5.0 3.5 1.3 0.3 setosa
iris %>%
dplyr::select(1:2) %>%
dplyr::sample_n(20) %>%
ripe(purrr::rerun,.n=1)
#> [[1]]
#> Sepal.Length Sepal.Width
#> 1 5.1 3.8
#> 2 6.6 3.0
#> 3 4.8 3.4
#> 4 5.5 2.6
#> 5 6.7 3.1
#> 6 6.4 3.1
#> 7 5.0 2.3
#> 8 6.2 2.8
#> 9 4.8 3.4
#> 10 5.0 3.4
#> 11 5.9 3.2
#> 12 5.8 4.0
#> 13 5.8 2.7
#> 14 6.7 3.1
#> 15 5.6 2.8
#> 16 6.3 2.8
#> 17 6.9 3.1
#> 18 4.6 3.1
#> 19 5.5 2.4
#> 20 6.7 3.0
iris %>%
dplyr::select(1:2)%>%
dplyr::sample_n(20) %>%
dplyr::slice(1:5) %>%
ripe(purrr::rerun,.n=3)
#> [[1]]
#> Sepal.Length Sepal.Width
#> 1 5.3 3.7
#> 2 5.4 3.0
#> 3 6.2 2.2
#> 4 6.1 2.9
#> 5 6.6 3.0
#>
#> [[2]]
#> Sepal.Length Sepal.Width
#> 1 7.3 2.9
#> 2 5.6 3.0
#> 3 5.0 3.2
#> 4 7.4 2.8
#> 5 4.6 3.4
#>
#> [[3]]
#> Sepal.Length Sepal.Width
#> 1 4.8 3.1
#> 2 6.1 2.8
#> 3 6.6 2.9
#> 4 5.1 3.3
#> 5 4.9 3.1