prepare_cows: Process raw cow data to suitable form

Description Usage Arguments Details Value

View source: R/pre_simulation_process.R

Description

Transform an input csv into a suitable form, which is in a form of cow_table.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
prepare_cows(
  csv,
  param,
  data = NULL,
  output_file = NULL,
  today = Sys.Date(),
  create_calf_data = F,
  modify_prevalence = NULL,
  area_name = NULL,
  seed = NULL
)

Arguments

csv

File path of an input csv file. See the Detail section to know about form of input csv.

param

See param.

data

data.frame as a input instead of csv. See the Detail section to know about form of input data.

output_file

The name of an output file (must be a csv file). If NULL, no output file is created.

today

A Date class object or a character in "YYYY/MM/DD" format. The date used to calculate age from date_birth when age is not set. today is automatically calculated when both of age and date_birth are filled and date_birth is in form of Date rather than number (which means that the cow was born $n$ month ago) and the value passed to this argument is ignored.

create_calf_data

logical or a numeric. Create data for young cows based on cow data in the input. Set this argument when the input does not contain data for young cows (e.g. when you use Nyuken data). If TRUE, create cows younger than the youngest cows in the input. If a numeric is set, create cows equal to or younger than that age.

modify_prevalence

One or two numbers within a range of 0 to 1. If the parameter is not NULL, modify infection_status column to make proportion of infected cows (when modify_prevalence is a number) orialandipl + eblcows (whenmodify_prevalence' is two numbers) accordingly.

area_name

If area_id is specified by character, specify integer area_id like c(barnA = 1, barnB = 2, ...).

seed

Seed for a simulation.

Details

An input csv file can have following columns. The csv file must contain age column.

For further detail of each variable, see cow_table.

Value

A csv file which can be used as an input for simulate_blv_spread().


fmsan51/blvibmjp documentation built on Sept. 2, 2020, 9:04 p.m.