as_lfq_data: Coerce to lfq_data

View source: R/coerce.R

as_lfq_dataR Documentation

Coerce to lfq_data

Description

Generic function to convert various data formats into lfq_data objects. Methods can be defined for specific input classes to enable seamless interoperability with other genomic surveillance packages.

Usage

as_lfq_data(x, ...)

## S3 method for class 'lfq_data'
as_lfq_data(x, ...)

## S3 method for class 'data.frame'
as_lfq_data(x, ...)

Arguments

x

An object to coerce.

...

Additional arguments passed to methods. For the data.frame method, these are passed to lfq_data().

Value

An lfq_data object.

An lfq_data object.

An lfq_data object.

See Also

lfq_data() for the primary constructor.

Examples

df <- data.frame(
  date    = rep(as.Date("2024-01-01") + c(0, 7), each = 2),
  lineage = rep(c("A", "B"), 2),
  count   = c(80, 20, 60, 40)
)
x <- as_lfq_data(df, lineage = lineage, date = date, count = count)
x


lineagefreq documentation built on April 3, 2026, 9:09 a.m.