help: Documentation Shortcuts

Description Usage Arguments See Also Examples

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

1
"?"(e1, e2)

Arguments

e1

The type of documentation

e2

The topic of documentation

See Also

?

Examples

 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

Example output

Attaching package: 'types'

The following object is masked from 'package:utils':

    ?

types documentation built on May 1, 2019, 10:29 p.m.