save_okplan: Writes the surveillance selection to a standardised file.

View source: R/save_okplan.R

save_okplanR Documentation

Writes the surveillance selection to a standardised file.

Description

The surveillance selection is written to a standardised file. The file is standardised to include a standard set of columns and have the records in a standard order.

Usage

save_okplan(
  data,
  filename,
  filepath,
  sortvar = c("ok_hensiktkode", "ok_driftsformkode", "statuskode",
    "prioritet_av_reserve", "eier_lokalitetnr"),
  ...
)

Arguments

data

[data.frame]
The sampling plan with the units to be reported.

filename

[character(1)]
The name of the csv file including extension.

filepath

[character(1)]
The path to the csv file.

sortvar

[character]
The sort order for the records in the csv-file. Defaults to c("ok_hensiktkode", "ok_driftsformkode", "statuskode", "prioritet_av_reserve", "eier_lokalitetnr")

...

Other arguments to be passed to utils::write.csv2.

Details

The data is saved as an "okplan" file that will be used the source file when the selection list is generated.

The function uses NVIdb::standardize_columns. to select and order the columns. The formatting information is taken from OK_column_standards.

Value

None. Saves a data frame with the selection in a standard csv file.

Author(s)

Petter Hopp Petter.Hopp@vetinst.no

Examples

## Not run: 
library(OKplan)
td <- tempdir()
okplan <- as.data.frame(list("ok_hensiktkode" = c("01002", "01002"),
                             "ok_driftsformkode" = c("010202", "010202"),
                             "statuskode" = c(1, 1),
                             "prioritet_av_reserve" = c(NA, NA),
                             "eier_lokalitetnr" = c("1101123456", "1102123456")))
write_okplan(data = okplan,
             filename = "okplan_species_disease",
             filepath = td)

## End(Not run)

NorwegianVeterinaryInstitute/OKplan documentation built on Dec. 20, 2024, 10:41 a.m.