Learn R Programming

vortexR (version 1.1.7)

conv_l_yr: Convert 'census' data into long format

Description

conv_l_yr converts the first element of the output from collate_yr (census) in long format. This can be then fed into downstream analysis (e.g. fit_regression)

Usage

conv_l_yr(
  data,
  npops_noMeta = 1,
  appendMeta = FALSE,
  project,
  scenario,
  yrs = c(1, 2),
  save2disk = TRUE,
  dir_out = "ProcessedData"
)

Arguments

data

The df 'census' from collate_yr

npops_noMeta

The total number of populations excluding the metapopulation, default: 1

appendMeta

Whether to calculate data for the metapopulation, default: FALSE

project

Vortex project name (used to name the output)

scenario

Vortex scenario name (used to name the output)

yrs

The year(s) that need to be retained in the output

save2disk

Whether to save the data as rda and csv, default: TRUE

dir_out

The local path to store the output. Default: ProcessedData

Value

The census data.frame in long format

Details

yrs is used to indicate the years to be retained in the output. If more than one year is required, these may be requested defining a numeric vector, e.g. yrs=c(10, 20, 30). All simulated years can be included in the output by passing a numeric vector with all years. For example, assuming that 100 years were simulated, using yrs=1:100 would retain all 100 years in the output.

dir_out is created within the working directory unless a full path is provided.

Examples

Run this code
# NOT RUN {
# Using Pacioni et al. example data. See ?pac.yr for more details.
data(pac.yr)
lyr.classic <- conv_l_yr(pac.yr[[1]] , yrs=c(60, 120), save2disk=FALSE)
# }

Run the code above in your browser using DataLab