Learn R Programming

rtype (version 0.1-1)

typed-assign: 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<="" code="">

value
value to be assigned

Examples

Run this code
## 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)

Run the code above in your browser using DataLab