Skip to contents

This function returns the number of entities in a PGS Catalog object. To avoid ambiguity with dplyr::n() use quincunx::n().

Usage

n(x, unique = FALSE)

# S4 method for scores
n(x, unique = FALSE)

# S4 method for publications
n(x, unique = FALSE)

# S4 method for traits
n(x, unique = FALSE)

# S4 method for performance_metrics
n(x, unique = FALSE)

# S4 method for sample_sets
n(x, unique = FALSE)

# S4 method for cohorts
n(x, unique = FALSE)

# S4 method for trait_categories
n(x, unique = FALSE)

# S4 method for releases
n(x, unique = FALSE)

Arguments

x

A scores, publications, traits, performance_metrics, sample_sets, cohorts, trait_categories or releases object.

unique

Whether to count only unique entries (TRUE) or not (FALSE).

Value

An integer scalar.

Examples

if (FALSE) { # interactive()
# Return the number of polygenic scores in a scores object:
my_scores <- get_scores(pgs_id = c('PGS000007', 'PGS000007', 'PGS000042'))
n(my_scores)

# If you want to count unique scores only, then use the `unique` parameter:
n(my_scores, unique = TRUE)

# Total number of curated publications in the PGS Catalog:
all_pub <- get_publications(interactive = FALSE, progress_bar = FALSE)
n(all_pub)

# Total number of curated traits in the PGS Catalog:
all_traits <- get_traits(interactive = FALSE, progress_bar = FALSE)
n(all_traits)
}