The randrows() function randomly samples a specified number of rows from a dataframe.
Arguments
- .data
The dataframe from which rows are to be sampled.
- n
The number of rows to be randomly sampled. Default is 5.
Examples
# Randomly sample 3 rows from the dataset
randrows(esmdata_sim, n = 3)
#> dyad role obsno id age cond_dyad scheduled sent
#> 1123 9 1 3 17 25 condB 2018-08-07 10:00:14 2018-08-07 10:00:31
#> 889 7 1 49 13 42 condB 2018-11-22 12:00:22 2018-11-22 12:00:27
#> 740 6 1 40 11 36 condA 2019-06-04 12:00:12 2019-06-04 12:00:14
#> start end contact PA1 PA2 PA3 NA1 NA2 NA3
#> 1123 2018-08-07 10:00:43 2018-08-07 10:04:02 0 100 1 66 1 20 29
#> 889 2018-11-22 12:00:57 2018-11-22 12:03:50 0 7 1 28 23 1 53
#> 740 2019-06-04 12:00:22 2019-06-04 12:01:30 0 1 1 11 9 1 98
#> location
#> 1123 E
#> 889 E
#> 740 B
