types v1.0.0

0

Monthly downloads

0th

Percentile

Type Annotations

Provides a simple type annotation for R that is usable in scripts, in the R console and in packages. It is intended as a convention to allow other packages to use the type information to provide error checking, automatic documentation or optimizations.

Readme

CRAN\_Status\_Badge Travis-CI Build Status Coverage Status AppVeyor Build Status

Types for R

This package provides a simple type annotation for R that is usable in scripts, in the R console and in packages. It is intended as a convention to allow other packages or IDE's to use the type information to provide error checking, automatic documentation or optimizations.

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.

? when used on the command line continues to work as before, accessing the R help pages for the topic requested.

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 %% 2 == 0
} ? boolean

Prior work

The argufy package by Gábor Csárdi was an exploration of typed arguments and was the original impetus of the ? syntax.

Functions in types

Name Description
? Documentation Shortcuts
removeTypes Remove types from a language object
types Static types for R
No Results!

Last month downloads

Details

License MIT + file LICENSE
Encoding UTF-8
LazyData true
NeedsCompilation no
Packaged 2016-10-14 14:55:50 UTC; jhester
Repository CRAN
Date/Publication 2016-10-15 11:31:52
depends R (>= 3.0.3)
Contributors Jim Hester

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/types)](http://www.rdocumentation.org/packages/types)