Description Usage Arguments Details Value Numeric coercion methods Comparison and value matching methods See Also Examples
View source: R/class-projects_stage.R
Objects of this class are merely a character string containing a number and a name of one of seven project development stages.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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
|
x |
For For |
table |
An integer number, a character string, or a
|
nomatch |
See |
incomparables |
An integer number, a character string, or a
|
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.
For projects_stage()
, an S3 vector of class
projects_stage
.
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.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.