tof_downsample_prop | R Documentation |
This function downsamples the number of cells in a 'tof_tbl' by randomly selecting a 'prop_cells' proportion of the total number of cells with each unique combination of values in 'group_cols'.
tof_downsample_prop(tof_tibble, group_cols = NULL, prop_cells)
tof_tibble |
A 'tof_tbl' or a 'tibble'. |
group_cols |
Unquoted names of the columns in 'tof_tibble' that should be used to define groups from which 'prop_cells' will be downsampled. Supports tidyselect helpers. Defaults to 'NULL' (no grouping). |
prop_cells |
A proportion of cells (between 0 and 1) that should be sampled from each group defined by 'group_cols'. |
A 'tof_tbl' with the same number of columns as the input 'tof_tibble', but fewer rows. Specifically, the number of rows should be 'prop_cells' times the number of rows in the input 'tof_tibble'.
Other downsampling functions:
tof_downsample()
,
tof_downsample_constant()
,
tof_downsample_density()
sim_data <-
dplyr::tibble(
cd45 = rnorm(n = 1000),
cd38 = rnorm(n = 1000),
cd34 = rnorm(n = 1000),
cd19 = rnorm(n = 1000),
cluster_id = sample(letters, size = 1000, replace = TRUE)
)
# sample 10% of all cells from the input data
tof_downsample_prop(
tof_tibble = sim_data,
prop_cells = 0.1
)
# sample 10% of all cells from each cluster in the input data
tof_downsample_prop(
tof_tibble = sim_data,
group_cols = cluster_id,
prop_cells = 0.1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.