symb2I: Convert names of pathogen/combinations into 0/1 coding

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Convert names of pathogen/combinations into 0/1 coding

Usage

1
symb2I(pathogen_name, pathogen_list)

Arguments

pathogen_name

The allowed pathogen name (can be a combination of pathogens in "pathlist")

pathogen_list

The complete list of pathogen names

Value

A 1 by length(pathlist) matrix of binary code (usually for pathogen presence/absence)

Examples

1
2
3
4
symb2I("A",c("A","B","C"))
symb2I("A+B",c("A","B","C"))
symb2I("NoA",c("A","B","C"))
symb2I(c("A","B+C"),c("A","B","C")) # gives a 2 by 3 matrix.

zhenkewu/nplcm documentation built on May 28, 2017, 1:43 p.m.