l_ply: Split list, apply function, and discard results.

Description Usage Arguments Value Input Output References See Also Examples

View source: R/l_ply.r

Description

For each element of a list, apply function and discard results

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
l_ply(
  .data,
  .fun = NULL,
  ...,
  .progress = "none",
  .inform = FALSE,
  .print = FALSE,
  .parallel = FALSE,
  .paropts = NULL
)

Arguments

.data

list to be processed

.fun

function to apply to each piece

...

other arguments passed on to .fun

.progress

name of the progress bar to use, see create_progress_bar

.inform

produce informative error messages? This is turned off by default because it substantially slows processing speed, but is very useful for debugging

.print

automatically print each result? (default: FALSE)

.parallel

if TRUE, apply function in parallel, using parallel backend provided by foreach

.paropts

a list of additional options passed into the foreach function when parallel computation is enabled. This is important if (for example) your code relies on external data or packages: use the .export and .packages arguments to supply them so that all cluster nodes have the correct environment set up for computing.

Value

Nothing

Input

This function splits lists by elements.

Output

All output is discarded. This is useful for functions that you are calling purely for their side effects like displaying plots or saving output.

References

Hadley Wickham (2011). The Split-Apply-Combine Strategy for Data Analysis. Journal of Statistical Software, 40(1), 1-29. http://www.jstatsoft.org/v40/i01/.

See Also

Other list input: laply(), ldply(), llply()

Other no output: a_ply(), d_ply(), m_ply()

Examples

1
2

Example output

piece
10 13 14 15 16 17 18 19 20 21 22 23 24 26 27 30 32 34 
 2  1  1  4  3  1  2  3  1  4  1  2  1  1  1  2  1  1 
piece
 4  6  8 
11  7 14 
piece
 71  76  79  95 108 120 121 141 145 147 160 168 225 258 276 301 304 318 350 351 
  1   1   2   1   1   2   1   1   1   1   2   2   1   1   3   1   1   1   1   1 
360 400 440 460 472 
  2   1   1   1   1 
piece
 52  62  65  66  91  93  95  97 105 109 110 113 123 150 175 180 205 215 230 245 
  1   1   1   2   1   1   1   1   1   1   3   1   2   2   3   3   1   1   1   2 
264 335 
  1   1 
piece
 3  4  5 
13 18  1 
piece
 2  3  4  5 
 8 13  8  3 
piece
14 15 16 17 18 19 20 23 
 1  2  3  9  5  7  4  1 
piece
 0  1 
18 14 
piece
 0  1 
19 13 
piece
 3  4  5 
15 12  5 
piece
 1  2  3  4  6  8 
 7 10  3 10  1  1 
   Length     Class      Mode 
    21699 character character 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   1871    1937    1970    1961    1988    2007 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  1.000   1.000   1.000   1.093   1.000   4.000 
   Length     Class      Mode 
    21699 character character 
   Length     Class      Mode 
    21699 character character 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.00   29.00   59.00   72.82  125.00  165.00 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    0.0    25.0   131.0   225.4   435.0   705.0 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.00    2.00   15.00   31.78   58.00  177.00 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.00    4.00   32.00   61.76  119.00  257.00 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.00    0.00    5.00   10.45   19.00   64.00 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.000   0.000   1.000   2.194   3.000  28.000 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.000   0.000   1.000   5.234   7.000  73.000 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
   0.00    1.00   14.00   29.59   51.00  184.00      12 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
  0.000   0.000   1.000   5.168   5.000 130.000     250 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
    0.0     0.0     0.0     2.1     3.0    42.0    4525 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.00    1.00   11.00   22.49   38.00  232.00 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
   0.00    4.00   19.00   29.26   45.00  189.00    1305 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
  0.000   0.000   0.000   2.292   3.000 120.000    7528 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
  0.000   0.000   0.000   1.543   2.000  51.000     377 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
  0.000   0.000   1.000   3.388   5.000  52.000     960 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
  0.000   0.000   1.000   1.842   3.000  19.000    7390 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
  0.000   0.000   2.000   4.774   8.000  36.000    5272 

plyr documentation built on March 3, 2020, 5:07 p.m.

Related to l_ply in plyr...