Skip to content

Instantly share code, notes, and snippets.

View moredatapls's full-sized avatar
💻
processing...

Helge Brügner moredatapls

💻
processing...
View GitHub Profile
@moredatapls
moredatapls / README.md
Last active June 17, 2019 09:27
R: sample rows from a data.table with different fractions per class

I needed a way to easily sample rows from a data.frame with different fractions per class (as opposed to dplyr::sample_frac() that only supports a single fraction). So I wrote this little function below.