replicate_df: Replicate a prediction data frame over time

View source: R/utils.R

replicate_dfR Documentation

Replicate a prediction data frame over time

Description

Useful for replicating prediction grids across time slices used in model fitting.

Usage

replicate_df(dat, time_name, time_values)

Arguments

dat

Data frame.

time_name

Name of time column in output.

time_values

Time values to replicate dat over.

Value

A data frame replicated over time_values with a new column based on time_name.

Examples


df <- data.frame(variable = c("a", "b"))
replicate_df(df, time_name = "year", time_values = 1:3)

head(qcs_grid)
nd <- replicate_df(qcs_grid, "year", unique(pcod$year))
head(nd)
table(nd$year)

pbs-assess/sdmTMB documentation built on Dec. 10, 2024, 9:25 a.m.