Package 'rtype'

Title: A strong type system for R
Description: A strong type system for R which supports symbol declaration and assignment with type checking and condition checking.
Authors: Kun Ren <[email protected]>
Maintainer: Kun Ren <[email protected]>
License: MIT + file LICENSE
Version: 0.1-1
Built: 2024-11-26 05:22:22 UTC
Source: https://github.com/renkun-ken/rtype

Help Index


Declare symbols

Description

Declare symbols

Usage

declare(..., .envir = parent.frame())

Arguments

...

Symbols to declare

.envir

environment to store the symbols

Examples

declare(x,y=numeric(),z=integer())

Assign with type checking

Description

Assign with type checking

Usage

atomic(x, ...) <- value

integer(x, ...) <- value

numeric(x, ...) <- value

double(x, ...) <- value

logical(x, ...) <- value

character(x, ...) <- value

raw(x, ...) <- value

complex(x, ...) <- value

matrix(x, ...) <- value

array(x, ...) <- value

list(x, ...) <- value

pairlist(x, ...) <- value

envir(x, ...) <- value

name(x, ...) <- value

symbol(x, ...) <- value

call(x, ...) <- value

factor(x, ...) <- value

fun(x, ...) <- value

expression(x, ...) <- value

language(x, ...) <- value

object(x, ...) <- value

table(x, ...) <- value

recursive(x, ...) <- value

vector(x, ...) <- value

data.frame(x, ...) <- value

null(x, ...) <- value

check(x, ...) <- value

Arguments

x

symbol

...

additional conditions taking the following forms:

1. fun = v, i.e. fun(x) must be equal v.

2. cond, i.e. cond(x) must be TRUE.

3. a function like function(x) mean(x) <= 5.0

value

value to be assigned

Examples

## Not run: 
x <- 10L
atomic(x) <- 20
numeric(x) <- 10
numeric(x, length = 10L) <- 1:10

cond1 <- function(x) mean(x) <= 5
numeric(x, cond1) <- 0:9

## End(Not run)