filter_sources: filter_sources

Description Usage Arguments Details Value

View source: R/Postprocess.R

Description

This function is used to select a subset of sources from another "source" file.

Usage

1
2
3
filter_sources(in.file = "source_scen_prods.csv",
  out.file = "source_scen_subset.csv", ids = c("ALL"),
  types = c("ALL"))

Arguments

In.file

a csv file that contains expsoure info default = "source_scen_prods.csv"

Out.file

default = "source_scen_prods.csv"

IDS

default = "ALL"

Types

default = "ALL"

Details

This function is used to select a subset of sources from another "source" file. This is achieved by specifying either a list of the desired source ids, or one or more sources types. The allowed types are "A" for articles, "F" for foods, or "P" for products. Use the c() function to list more than one item (e.g. types=c("F","P") for foods and products). Any of the three types of source files (that is, source_scen, source_chem, or source_vars) may be used. Specifying specific sources is achieved using the "ids" argument. This may require examining the in.file beforehand, to obtain the correct source.id values for the desired sources.

Value

A .csv file of the same type as in.file, with the same variables and data, but fewer rows. The selected rows have source.type matching one of the elements in the "types" argument, and also have source.id matching one of the elements of the "ids" argument. If either argument is missing, then all sources automatically match it. Filter_sources also returns an R object containing the same data as the output .csv file.


HumanExposure/SHEDSDevel documentation built on Oct. 30, 2019, 6:49 p.m.