? {types} | R Documentation |
Documentation Shortcuts
Description
'?' when used interactively continues to work as before, accessing the R help pages for the topic requested.
When used within a R expression it can be used to add a type annotation. The annotations are syntactically valid R code rather than comments, which provides additional assurance they are specified properly. However this package does not do anything with the type annotations, they have no effect on the calculated result.
Usage
"?"(e1, e2)
Arguments
e1 |
The type of documentation |
e2 |
The topic of documentation |
See Also
Examples
# Function arguments can be annotated with types
f <- function(x = 1 ? numeric) {
x + 1
}
# Default arguments can also be annotated (the `=` is required however)
f <- function(x = ? numeric) {
x + 1
}
# Function statements can be annotated with types
f <- function(x = "Yay") {
paste(x, "types!") ? character
}
# Function return values can be annotated with types
f <- function(x = 1) {
x
} ? boolean
[Package types version 1.0.0 Index]