projects (version 2.1.3)

projects_stage: projects_stage vector

Description

Objects of this class are merely a character string containing a number and a name of one of seven project development stages.

Usage

projects_stage(x = character())

match.projects_stage(x, table, nomatch = NA_integer_, incomparables = NULL)

# S4 method for projects_stage,ANY match(x, table, nomatch = NA_integer_, incomparables = NULL)

# S4 method for ANY,projects_stage match(x, table, nomatch = NA_integer_, incomparables = NULL)

# S4 method for projects_stage,projects_stage match(x, table, nomatch = NA_integer_, incomparables = NULL)

`%in%.projects_stage`(x, table)

# S4 method for projects_stage %in%(x, table)

Arguments

x

For projects_stage(), an integer or character vector. For

For match() and %in%, an integer, a character string, or a projects_stage object. See match() and Comparison and value matching methods below.

table

An integer number, a character string, or a projects_stage object. See match() and Comparison and value matching methods below.

nomatch

See match().

incomparables

An integer number, a character string, or a projects_stage object. See match().

Value

For projects_stage(), an S3 vector of class projects_stage.

Numeric coercion methods

as.integer(), as.double(), and as.numeric() return the stage number of the projects_stage object as an integer/double. The methods for the comparison and value matching functions described below make use of these numeric coercion methods. Users desiring to apply value matching functions other than the ones described below may similarly take advantage of these.

Comparison and value matching methods

Methods for the Comparison operators as well as match() and %in% enable users to test equality and to value match among projects_stage objects and as well as between projects_stage objects and unclassed numbers/characters. When comparing or value matching against a numeric vector, the projects_stage object is first coerced to an integer with the as.integer() method described above. When testing or value matching against a character vector, the character vector is validated against the list of project stages enumerated above.

Details

A projects_stage object is either a missing value (NA) or one of:

0: idea 1: design 2: data collection 3: analysis 4: manuscript 5: under review 6: accepted

projects_stage() validates and coerces a vector of the above integers or strings to a projects_stage S3 vector.

See Also

Ops; Methods_for_Nongenerics.

Examples

Run this code
# NOT RUN {
stage <- projects_stage("4: manuscript")

as.integer(stage) # 4

stage == 4       # TRUE
stage != 4       # FALSE
stage <  6       # TRUE

stage %in% c(3:6)  # TRUE
match(stage, 0:4)  # 5

stage %in% c("design", "manusc", "idea")  # TRUE

more_stages <- projects_stage(c("0: idea", "4: manuscript", "1: design"))

match("MAnuscRIPT", more_stages)      # 2
# }

Run the code above in your browser using DataLab