byX | R Documentation |

One subset consists of 'subset_size' unique groups and thus of all rows which in 'data' which have any of these groups. The last subset might have less groups, if the number of unique groups is not dividable by subset_size.

```
byX(data, indices, subset_size = 5, FUN, sort_indices = TRUE, ...)
```

`data` |
Data.frame whose subsets to use on FUN |

`indices` |
Vector of group assignments, same length as nrow(data) |

`subset_size` |
Number of groups to use in one subset |

`FUN` |
Function applied to subsets of data |

`sort_indices` |
Sort groups (by their sorted character(!) names) before building subsets |

`...` |
More arguments to FUN |

FUN is applied on each subset.

list of function result (one entry for each subset)

```
byX(data.frame(d=1:10), 1:10, 2, sum)
```

PTXQC documentation built on May 31, 2023, 7:54 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.