Using R to Generate Statistical Simulations
Publish date: 2024-04-25
Def: Choose rows by their ordinal position in the tbl.
slice(df, c(1, 2, 3)) # rows 1, 2 ,3 slice(df, rep(c(1, 2), each = 3)) # rows 1, 1, 1, 2, 2, 2 slice(df, rep(c(1, 2), c(2, 3))) # rows 1, 1, 2, 2, 2
- Simulations have nested structures with repeated obs
- For example each simu_id has 100 obs
- This saves you most of your headache while doing simulations
ncG1vNJzZmimqZ2upLfRZ5mlp5JjsLC%2BxGeuoqaUpMS0es2eq2iooprAprrTmquip56ofLW1w7Ktnqqjmnq0tcyuo5qsmaS7tKuynpmaq6Serq95p6KbmqSXpHupwMyl