Package 'GenTag'

Title: Generate Color Tag Sequences
Description: Implement a coherent and flexible protocol for animal color tagging. 'GenTag' provides a simple computational routine with low CPU usage to create color sequences for animal tag. First, a single-color tag sequence is created from an algorithm selected by the user, followed by verification of the combination uniqueness. Three methods to produce color tag sequences are provided. Users can modify the main function core to allow a wide range of applications.
Authors: Carlos Biagolini-Jr.
Maintainer: Carlos Biagolini-Jr.<[email protected]>
License: GPL (>= 2)
Version: 1.01
Built: 2024-11-25 05:24:55 UTC
Source: https://github.com/biagolini/gentag

Help Index


All equal tag sequence sample

Description

Create combinations with equal sample probability to all colors.

Usage

allequal(ntag, colorsname, nspecial = 0, name1 = "Metal",
  name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1,
  nspecial2 = 1)

Arguments

ntag

Number of tag to be used in each animal.

colorsname

Names/Code of color tags to be sample.

nspecial

Number of special tags/codes, such as metallic, 'EMPTY', or flag (min 0, max 2).

name1

Name of special tag 1.

name2

Name of special tag 2.

location1

Position (or group of positions) to special band 1.

location2

Position (or group of positions) to special band 2.

nspecial1

Number of special tag 1 that will be present in all sequences genetated.

nspecial2

Number of special tag 2 that will be present in all sequences genetated.

Value

A sequencie of tags

Examples

# Create an object contain the name/code of tag colors
tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow')
# Generate color tag combination without especial tags
genseq(30, 4, colorsname= tcol)
# Generate color tag combination with especial color (ex metallic tag for numeric identification)
genseq(30, 4, tcol, nspecial=1, name1='Metal',location1=c(2,4))
# For ongoing works, use the argument usedcombinations to informe the previus used combinations
data(pre_used) # Data example
genseq(100, 4, tcol, usedcombinations=pre_used[,1:4])

Estimates remaining color

Description

Estimates number of remaining color tags in the field

Usage

erc(usedcombinations, yearusedcombinations, currentyear = NA,
  yearsurvival = NA, lifespan = NA, hide_color = NA)

Arguments

usedcombinations

Pre used combinations.

yearusedcombinations

The year in which the combination was used.

currentyear

Current year.

yearsurvival

An estimation of the proportion of animals that survive between years.

lifespan

Combinations older the lifespan will be automatically disregard.

hide_color

Color(s) to be hide in the estimation of remain colors tags present in nature.

Value

A estimation of the number of remaining color tags in the field.

Examples

## The function is currently defined as
data(pre_used) # Data example
erc(pre_used[,1:4],pre_used[,5],2019,0.85, hide_color='EMPTY')

Empty synonym code

Description

Find synonyms in a group of colors with code for empty tag.

Usage

escode(row_under_review, emptyname = NA, columns_set = NA)

Arguments

row_under_review

Color sequence to be analyzed.

emptyname

Code used to define empty code.

columns_set

Range of codes which belong to the same tag region.

Value

Matrix with all synonym

Examples

# Example of a full sequence
combination<- c('EMPTY','Red','Yellow','Red','Blue','Green')
# See synonym for the code group 1 to 3
escode(combination,'EMPTY',columns_set=1:3)

Empty synonym combination

Description

Find synonyms of a sequence with code for empty tag.

Usage

escombination(row_under_review, emptyname, g1 = NA, g2 = NA, g3 = NA,
  g4 = NA, g5 = NA, g6 = NA)

Arguments

row_under_review

Color sequence to be analyzed.

emptyname

Code used to define empty code.

g1

Group of tags from group 1. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'.

g2

Group of tags from group 2. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'.

g3

Group of tags from group 3.

g4

Group of tags from group 4.

g5

Group of tags from group 5.

g6

Group of tags from group 6.

Value

Matrix with all synonyms

Examples

# Example of a full sequence
combination<- c('EMPTY','Red','Yellow','Red','Blue','Green')  # See synonym for the full sequence
escombination(combination,'EMPTY',g1=1:3,g2=4:6)

Empty synonym dataset

Description

Find synonyms in a dataset contain combination with code for empty tag.

Usage

esdataset(tag_sheet, emptyname, g1 = NA, g2 = NA, g3 = NA, g4 = NA,
  g5 = NA, g6 = NA)

Arguments

tag_sheet

Dataset contain sequences to be analyzed.

emptyname

Code used to define empty code.

g1

Group of tags from group 1. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'.

g2

Group of tags from group 2. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'.

g3

Group of tags from group 3.

g4

Group of tags from group 4.

g5

Group of tags from group 5.

g6

Group of tags from group 6.

Value

Matrix with all synonyms for from entire dataset

Examples

(combination<- matrix(c('EMPTY','Red','Blue','Green'),4,6,TRUE)) # Example of a dataset
esdataset(combination,'EMPTY',g1=1:3,g2=4:6)

All equal tag sequence sample

Description

Create combinations with equal sample probability to all colors.

Usage

genseq(ncombinations = 100, ntag = 4, colorsname,
  gen_method = "allequal", usedcombinations = NA, colorsf = NA,
  nspecial = 0, name1 = "Metal", name2 = "EMPTY", location1 = 1,
  location2 = 2, nspecial1 = 1, nspecial2 = 1, emptyused = FALSE,
  emptyname = "EMPTY", currentyear = NA, yearsurvival = 1,
  lifespan = NA, iotf = FALSE, yearusedcombinations = NA,
  speed = 1, ignorecolor = NA, g1 = NA, g2 = NA, g3 = NA,
  g4 = NA, g5 = NA, g6 = NA, parameterslist = NA)

Arguments

ncombinations

Number of combinations to be generated.

ntag

Number of tag to be used in each animal.

colorsname

Names/Code of color tags to be sample.

gen_method

method used for sample colors for tag sequence.

usedcombinations

Pre used combinations.

colorsf

Frequencies/ratio for color sample.

nspecial

Number of special tags/codes, such as metallic, 'EMPTY', or flag (min 0, max 2).

name1

Name of special tag 1.

name2

Name of special tag 2.

location1

Position (or group of positions) to special band 1.

location2

Position (or group of positions) to special band 2.

nspecial1

Number of special tag 1 that will be present in all sequences genetated.

nspecial2

Number of special tag 2 that will be present in all sequences genetated.

emptyused

If pre-used combination has code for empty set as TRUE, otherwise FALSE

emptyname

Code used to define empty code.

currentyear

Current year.

yearsurvival

An estimation of the proportion of animals that survive between years.

lifespan

Combinations older the lifespan will be automatically disregard.

iotf

Ignore older than lifespan. If TRUE ignore pre-used combinations older than lifespan

yearusedcombinations

The year in which the combination was used.

speed

Speed for color frequency adjustment.

ignorecolor

Color to be ignored on lifexp.

g1

Group of tags from group 1. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'.

g2

Group of tags from group 2. For example, in a code of 6 colors for bird tag, tags from 1 to 3 belongs to the left leg, and tags from 1 to 3 belongs to the right. g1 must to address the left leg, and g2 must to address right leg. Thus: 'g1=1:3' and 'g2=4:6'.

g3

Group of tags from group 3.

g4

Group of tags from group 4.

g5

Group of tags from group 5.

g6

Group of tags from group 6.

parameterslist

parameters for methods not provide by 'GenTag'

Value

A list of combinations

Examples

# Create an object contain the name/code of tag colors
tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow')
# Generate color tag combination without especial tags
genseq(30, 4, colorsname= tcol)
# Generate color tag combination with especial color (ex metallic tag for numeric identification)
genseq(30, 4, tcol, nspecial=1, name1='Metal', location1=c(2,4))
# For ongoing works, use the argument usedcombinations to informe the previus used combinations
data(pre_used) # Data example
genseq(30, 4, colorsname= tcol, usedcombinations=pre_used[,1:4])
combinations<-genseq(100, 4, tcol) # save combinations into an object

Life expectancy tag sequence sample

Description

Create combinations with variable sample probability.

Usage

lifexp(ntag, colorsname, nspecial = 0, name1 = "Metal",
  name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1,
  nspecial2 = 1, currentyear = NA, yearsurvival = 1, lifespan = NA,
  yearusedcombinations, usedcombinations, speed = 1, ignorecolor = NA)

Arguments

ntag

Number of tag to be used in each animal.

colorsname

Names/Code of color tags to be sample.

nspecial

Number of special tags/codes, such as metallic, 'EMPTY', or flag (min 0, max 2).

name1

Name of special tag 1.

name2

Name of special tag 2.

location1

Position (or group of positions) to special band 1.

location2

Position (or group of positions) to special band 2.

nspecial1

Number of special tag 1 that will be present in all sequences genetated.

nspecial2

Number of special tag 2 that will be present in all sequences genetated.

currentyear

Current year.

yearsurvival

An estimation of the proportion of animals that survive between years.

lifespan

Combinations older the lifespan will be automatically disregard.

yearusedcombinations

The year in which the combination was used.

usedcombinations

Pre used combinations.

speed

Speed for color frequency adjustment.

ignorecolor

Color to be ignored on lifexp.

Value

A sequencie of tags

Examples

data(pre_used) # Data example
# Create an object contain the name/code of tag colors
tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow')
genseq(30, 4,tcol, 'lifexp', pre_used[,1:4], yearusedcombinations=pre_used[,5], 
yearsurvival= 0.8, lifespan=5, currentyear=2019)

Pre-used combinations combinations

Description

Pre-used combinations combinations

Usage

data(pre_used)

Format

A data frame with 1200 observations on the following 5 variables.

Tag_1

a factor with levels Black Brown Dark_Blue EMPTY Gray Green Light_Blue Orange Pink Red White Yellow

Tag_2

a factor with levels Black Brown Dark_Blue Gray Green Light_Blue Metal Orange Pink Red White Yellow

Tag_3

a factor with levels Black Brown Dark_Blue EMPTY Gray Green Light_Blue Orange Pink Red White Yellow

Tag_4

a factor with levels Black Brown Dark_Blue Gray Green Light_Blue Metal Orange Pink Red White Yellow

Year

a numeric vector

Details

Simulated database to example of registers of color tag sequences usage. Columns 1, 2 ,3 and 4 represent the tag code, and column 5 is the date of tagging.

Source

Simulated database


Summary color year

Description

Summary the number of each color tag used per year.

Usage

scy(usedcombinations, yearusedcombinations, hide_color = NA)

Arguments

usedcombinations

Pre used combinations.

yearusedcombinations

The year in which the combination was used.

hide_color

Color(s) to be hide in the estimation of remain colors tags present in nature.

Value

A summary of the numeber of tag colors used by year

Examples

data(pre_used) # Data example
scy(pre_used[,1:4],pre_used[,5], hide_color='EMPTY')

Variable frequency tag sequence sample

Description

Create combinations with defined sample probability to each colors.

Usage

vfrequency(ntag, colorsname, colorsf, nspecial = 0, name1 = "Metal",
  name2 = "EMPTY", location1 = 1, location2 = 2, nspecial1 = 1,
  nspecial2 = 1)

Arguments

ntag

Number of tag to be used in each animal.

colorsname

Names/Code of color tags to be sample.

colorsf

Frequencies/ratio for color sample.

nspecial

Number of special tags/codes, such as metallic, 'EMPTY', or flag (min 0, max 2).

name1

Name of special tag 1.

name2

Name of special tag 2.

location1

Position (or group of positions) to special band 1.

location2

Position (or group of positions) to special band 2.

nspecial1

Number of special tag 1 that will be present in all sequences genetated.

nspecial2

Number of special tag 2 that will be present in all sequences genetated.

Value

A sequencie of tags

Examples

tcol<-c('Black','Blue','Brown','Gray','Green','Pink','Purple','Red','White','Yellow')
p<-c(1,2,5,1,2,2,4,5,8,5)
genseq(30, 4, tcol, gen_method='vfrequency', colorsf=p)