study_count: Count the Number of Unique Observations in a Dataset or...

View source: R/study_count.R

study_countR Documentation

Count the Number of Unique Observations in a Dataset or Subset

Description

This simple function counts how many studies are in a dataset or in different subsets of your data. It assumes your dataset has a variable called unique_study_id.

Usage

study_count(dataset, counting_var = "unique_study_id")

Arguments

dataset

The dataset or subset.

counting_var

The variable to count unique observations (default: "unique_study_id").

Value

A tibble with the count of distinct observations.

Examples

# simple example: entire datasets
PaluckMetaSOP::sv_data |> study_count()
# example with split, apply to many datasets, and create summary table
## Not run: 
library(purrr)
PaluckMetaSOP::sv_data |> split(~study_design) |>
map(study_count) |> bind_rows(.id = "study_design")

## End(Not run)


setgree/PrejMetaFunctions documentation built on May 8, 2024, 6:38 p.m.