projects_stage {projects} | R Documentation |
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 signature 'projects_stage,ANY'
match(x, table, nomatch = NA_integer_, incomparables = NULL)
## S4 method for signature 'ANY,projects_stage'
match(x, table, nomatch = NA_integer_, incomparables = NULL)
## S4 method for signature 'projects_stage,projects_stage'
match(x, table, nomatch = NA_integer_, incomparables = NULL)
`%in%.projects_stage`(x, table)
## S4 method for signature 'projects_stage'
x %in% table
Arguments
x |
For For |
table |
An integer number, a character string, or a
|
nomatch |
See |
incomparables |
An integer number, a character string, or a
|
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.
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.
See Also
Examples
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