Description Usage Arguments See Also Examples
'?' 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.
1 | "?"(e1, e2)
|
e1 |
The type of documentation |
e2 |
The topic of documentation |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # 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
|
Attaching package: 'types'
The following object is masked from 'package:utils':
?
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.