Print slices per group of a dataframe
view_slice.RdWrapper around
Returns subsetted data invisibly.
Usage
view_slice(
data,
group,
select = NULL,
n_print = 1000,
n_slice = 1,
seed = NULL,
sample_within_group = FALSE,
sample = FALSE,
prop_sample = NULL,
return = FALSE
)Arguments
- data
dataframe. Contains data to print.
- group
character. Name of column to group by before subsetting.
- select
character vector. Name(s) of columns to select before printing.
- n_print
numeric. Number of slices to print per group.
- n_slice
numeric. Number of slices to select per group.
- seed
numeric. If not
NULL, then seed is set to this value. Default isNULL.- sample_within_group
logical. If
TRUEand sampling is selected, then sampling is performed within each group. Otherwise sampling is performed across the whole table. Default isFALSE.- sample
logical. If
TRUE, then rows are sampled. Unlessprop_sampleis specified, thenn_slicerows are sampled.- prop_sample
numeric. If not
NULL, then proportion of rows to sample. Overridesn_slice. Default isNULL.- return
logical. If
TRUE, then the subsetted table is returned. Otherwise,invisible(TRUE)is returned. Default isFALSE.
Examples
data("cars")
cars[, "grp"] <- rep(letters[1:5], each = 10)
view_slice(cars, group = "grp", n_slice = 2)
#> # A tibble: 10 × 3
#> # Groups: grp [5]
#> speed dist grp
#> <dbl> <dbl> <chr>
#> 1 4 2 a
#> 2 4 10 a
#> 3 11 28 b
#> 4 12 14 b
#> 5 14 36 c
#> 6 14 60 c
#> 7 17 50 d
#> 8 18 42 d
#> 9 20 52 e
#> 10 20 56 e