lapply_pb: complementary tools for Fragman

Description Usage Arguments Details Value References Examples

View source: R/lapply_pb.R

Description

This function is a wrapper of lapply function that allows the drawing of a progress bar to assess the speed of the process.

Usage

1
lapply_pb (X, FUN, ...)

Arguments

X

a vector (atomic or list) or an expression object. See see lapply.

FUN

the function to be applied to each element of X: see lapply.

...

passes another arguments to the typical lapply function.

Details

No major details

Value

Performs lapply drawing a progress bar

res

the same result than using lapply

References

See see lapply

Examples

1
2
l <- sapply(1:200, function(x) list(rnorm(1000)))
lapply_pb(l, mean)

Example output

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=                                                                     |   1%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |==                                                                    |   2%
  |                                                                            
  |==                                                                    |   3%
  |                                                                            
  |==                                                                    |   4%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |=====                                                                 |   6%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |=====                                                                 |   8%
  |                                                                            
  |======                                                                |   8%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |========                                                              |  11%
  |                                                                            
  |========                                                              |  12%
  |                                                                            
  |=========                                                             |  12%
  |                                                                            
  |=========                                                             |  13%
  |                                                                            
  |=========                                                             |  14%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |============                                                          |  16%
  |                                                                            
  |============                                                          |  17%
  |                                                                            
  |============                                                          |  18%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |===============                                                       |  21%
  |                                                                            
  |===============                                                       |  22%
  |                                                                            
  |================                                                      |  22%
  |                                                                            
  |================                                                      |  23%
  |                                                                            
  |================                                                      |  24%
  |                                                                            
  |=================                                                     |  24%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |===================                                                   |  26%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |===================                                                   |  28%
  |                                                                            
  |====================                                                  |  28%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |======================                                                |  31%
  |                                                                            
  |======================                                                |  32%
  |                                                                            
  |=======================                                               |  32%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |=======================                                               |  34%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |========================                                              |  35%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |==========================                                            |  36%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |==========================                                            |  38%
  |                                                                            
  |===========================                                           |  38%
  |                                                                            
  |===========================                                           |  39%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |=============================                                         |  42%
  |                                                                            
  |==============================                                        |  42%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |==============================                                        |  44%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |================================                                      |  46%
  |                                                                            
  |=================================                                     |  46%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |=================================                                     |  48%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |==================================                                    |  49%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |====================================                                  |  51%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=====================================                                 |  52%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |=====================================                                 |  54%
  |                                                                            
  |======================================                                |  54%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |========================================                              |  56%
  |                                                                            
  |========================================                              |  57%
  |                                                                            
  |========================================                              |  58%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |===========================================                           |  61%
  |                                                                            
  |===========================================                           |  62%
  |                                                                            
  |============================================                          |  62%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |============================================                          |  64%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |==============================================                        |  65%
  |                                                                            
  |==============================================                        |  66%
  |                                                                            
  |===============================================                       |  66%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |===============================================                       |  68%
  |                                                                            
  |================================================                      |  68%
  |                                                                            
  |================================================                      |  69%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |==================================================                    |  71%
  |                                                                            
  |==================================================                    |  72%
  |                                                                            
  |===================================================                   |  72%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |===================================================                   |  74%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |======================================================                |  76%
  |                                                                            
  |======================================================                |  77%
  |                                                                            
  |======================================================                |  78%
  |                                                                            
  |=======================================================               |  78%
  |                                                                            
  |=======================================================               |  79%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |==========================================================            |  82%
  |                                                                            
  |==========================================================            |  83%
  |                                                                            
  |==========================================================            |  84%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |=============================================================         |  86%
  |                                                                            
  |=============================================================         |  87%
  |                                                                            
  |=============================================================         |  88%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |================================================================      |  92%
  |                                                                            
  |=================================================================     |  92%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |=================================================================     |  94%
  |                                                                            
  |==================================================================    |  94%
  |                                                                            
  |==================================================================    |  95%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |====================================================================  |  96%
  |                                                                            
  |====================================================================  |  97%
  |                                                                            
  |====================================================================  |  98%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |===================================================================== |  99%
  |                                                                            
  |======================================================================| 100%
[[1]]
[1] 0.008392501

[[2]]
[1] -0.001161337

[[3]]
[1] -0.05756504

[[4]]
[1] -0.02529753

[[5]]
[1] 0.01905903

[[6]]
[1] 0.06283375

[[7]]
[1] 0.0192895

[[8]]
[1] -0.01973057

[[9]]
[1] 0.01347227

[[10]]
[1] -0.01588839

[[11]]
[1] 0.004434065

[[12]]
[1] 0.06278157

[[13]]
[1] 0.0179834

[[14]]
[1] -0.03484608

[[15]]
[1] -0.006595725

[[16]]
[1] 0.01678396

[[17]]
[1] 0.002502167

[[18]]
[1] 0.01702337

[[19]]
[1] -0.02612257

[[20]]
[1] 0.02805039

[[21]]
[1] -0.04668341

[[22]]
[1] -0.002409647

[[23]]
[1] 0.003498831

[[24]]
[1] -0.04499854

[[25]]
[1] 0.002746934

[[26]]
[1] -0.05040214

[[27]]
[1] 0.02493045

[[28]]
[1] -0.07825201

[[29]]
[1] -0.0250705

[[30]]
[1] 0.001151481

[[31]]
[1] 0.01781923

[[32]]
[1] 0.03754721

[[33]]
[1] -0.01516355

[[34]]
[1] 0.0390626

[[35]]
[1] -0.02424241

[[36]]
[1] 0.02410644

[[37]]
[1] 0.003367622

[[38]]
[1] 0.05570524

[[39]]
[1] 0.003271554

[[40]]
[1] -0.01056041

[[41]]
[1] 0.003202375

[[42]]
[1] 0.06013793

[[43]]
[1] -0.05321515

[[44]]
[1] 0.005290018

[[45]]
[1] 0.0474304

[[46]]
[1] -0.0364854

[[47]]
[1] 0.003056751

[[48]]
[1] -0.007861837

[[49]]
[1] 0.0006627492

[[50]]
[1] 0.007984598

[[51]]
[1] -0.01331281

[[52]]
[1] -0.02190987

[[53]]
[1] -0.04309272

[[54]]
[1] -0.01459012

[[55]]
[1] 0.01705905

[[56]]
[1] 0.02044676

[[57]]
[1] 0.01980562

[[58]]
[1] 0.01176886

[[59]]
[1] 0.09308046

[[60]]
[1] -0.03113181

[[61]]
[1] -0.02924078

[[62]]
[1] 0.02999601

[[63]]
[1] -0.06390955

[[64]]
[1] -0.00119911

[[65]]
[1] 0.02107463

[[66]]
[1] -0.02063606

[[67]]
[1] 0.004593543

[[68]]
[1] -0.01110739

[[69]]
[1] 0.0272658

[[70]]
[1] -0.01643294

[[71]]
[1] -0.002102465

[[72]]
[1] -0.001581329

[[73]]
[1] 0.04489874

[[74]]
[1] 0.02667264

[[75]]
[1] -0.004634986

[[76]]
[1] -0.03902116

[[77]]
[1] -0.01822245

[[78]]
[1] -0.01745532

[[79]]
[1] -0.01978814

[[80]]
[1] -0.03619213

[[81]]
[1] -0.01919552

[[82]]
[1] 0.002721788

[[83]]
[1] -0.009062819

[[84]]
[1] -0.0311183

[[85]]
[1] 0.009730638

[[86]]
[1] 0.01605833

[[87]]
[1] -0.0334808

[[88]]
[1] 0.02782214

[[89]]
[1] 0.05214424

[[90]]
[1] -0.01962281

[[91]]
[1] -0.03069344

[[92]]
[1] -0.006133761

[[93]]
[1] 0.03882399

[[94]]
[1] 0.02911527

[[95]]
[1] 0.03118519

[[96]]
[1] -0.001115257

[[97]]
[1] 0.03828046

[[98]]
[1] 0.01254568

[[99]]
[1] 0.0238238

[[100]]
[1] -0.01133549

[[101]]
[1] 0.007806116

[[102]]
[1] -0.06570018

[[103]]
[1] 0.01523989

[[104]]
[1] -0.02078181

[[105]]
[1] 0.01725547

[[106]]
[1] 0.008987964

[[107]]
[1] -0.002480335

[[108]]
[1] -0.03809036

[[109]]
[1] 0.01455388

[[110]]
[1] 0.00248215

[[111]]
[1] 0.02459304

[[112]]
[1] -0.02193073

[[113]]
[1] 0.03895544

[[114]]
[1] -0.01329214

[[115]]
[1] 0.005168993

[[116]]
[1] -0.03268586

[[117]]
[1] -0.009906776

[[118]]
[1] -0.02505235

[[119]]
[1] 0.00531563

[[120]]
[1] -0.02974929

[[121]]
[1] -0.01997301

[[122]]
[1] -0.005461926

[[123]]
[1] 0.03600038

[[124]]
[1] -0.03260571

[[125]]
[1] 0.02905206

[[126]]
[1] -0.01126906

[[127]]
[1] 0.05541071

[[128]]
[1] 0.01042381

[[129]]
[1] -0.009763528

[[130]]
[1] 0.02382639

[[131]]
[1] 0.0495165

[[132]]
[1] 0.03026125

[[133]]
[1] -0.03323152

[[134]]
[1] -0.01422852

[[135]]
[1] -0.08213421

[[136]]
[1] 0.05906657

[[137]]
[1] 0.004666309

[[138]]
[1] -0.02503618

[[139]]
[1] 0.0166028

[[140]]
[1] 0.00549739

[[141]]
[1] 0.06962977

[[142]]
[1] -0.03816122

[[143]]
[1] -0.008101804

[[144]]
[1] -0.0426265

[[145]]
[1] -0.002013362

[[146]]
[1] -0.01455626

[[147]]
[1] 0.04662915

[[148]]
[1] -0.02254531

[[149]]
[1] -0.006347934

[[150]]
[1] 0.03532221

[[151]]
[1] 0.0226249

[[152]]
[1] 0.02220632

[[153]]
[1] 0.002977625

[[154]]
[1] -0.02767094

[[155]]
[1] -0.007888198

[[156]]
[1] 0.01639906

[[157]]
[1] -0.01562622

[[158]]
[1] -0.03375898

[[159]]
[1] -0.0297939

[[160]]
[1] 0.02963113

[[161]]
[1] 0.0294077

[[162]]
[1] 0.03334845

[[163]]
[1] 0.01933723

[[164]]
[1] 0.0009179545

[[165]]
[1] -0.04787181

[[166]]
[1] 0.01952854

[[167]]
[1] 0.00106824

[[168]]
[1] 0.003773263

[[169]]
[1] -0.003245078

[[170]]
[1] 0.01156072

[[171]]
[1] -0.0163331

[[172]]
[1] 0.00523534

[[173]]
[1] 0.03605446

[[174]]
[1] -0.04411543

[[175]]
[1] -0.01218626

[[176]]
[1] 0.02840951

[[177]]
[1] -0.02558378

[[178]]
[1] -0.02284

[[179]]
[1] 0.04904248

[[180]]
[1] -0.05129372

[[181]]
[1] 0.02106923

[[182]]
[1] -1.316493e-05

[[183]]
[1] -0.001646537

[[184]]
[1] -0.03658221

[[185]]
[1] -0.01513012

[[186]]
[1] 0.0002255808

[[187]]
[1] 0.0128661

[[188]]
[1] 0.006217331

[[189]]
[1] -0.01632735

[[190]]
[1] -0.003470145

[[191]]
[1] 0.01514666

[[192]]
[1] -0.01586244

[[193]]
[1] -0.000440784

[[194]]
[1] 0.037872

[[195]]
[1] 0.03336379

[[196]]
[1] 0.02340509

[[197]]
[1] 0.02114502

[[198]]
[1] 0.03712665

[[199]]
[1] -0.005863706

[[200]]
[1] -0.0336287

Fragman documentation built on Jan. 14, 2018, 5:04 p.m.