Subset a `data.table`

with random subsampling within `by`

groups

subsetDT(DT, by, doSubset = TRUE, indices = FALSE)

## Arguments

DT |
A `data.table` |

by |
Character vector of column names to use for groups |

doSubset |
Logical or numeric indicating the number of subsamples to use |

indices |
Logical. If `TRUE` , this will return vector of row indices only. Defaults
to `FALSE` , i.e., return the subsampled `data.table` |

## Examples

#> subsampling initial dataset for faster estimation of maxBiomass parameter: using maximum of 3 samples per combination of ecoregionGroup and speciesCode. Change 'doSubset' to a different number if this is not enough