Supported types for RS classes include:
t_any
t_date
,t_dates
t_int
,t_ints
t_dbl
,t_dbls
t_num
,t_nums
t_char
,t_chars
t_bool
,t_bools
t_cplx
,t_cplxs
t_raw
,t_raws
t_factor
,t_factors
t_list
t_array
t_vector
t_matrix
t_dataframe
t_hashtab
t_environment
t_pairlist
t_func
t_expr
t_call
t_sym
t_lang
t_obj
t_prim
Note that there are scalar and vector versions of some types,
such as t_int
and t_ints
.
The former allows for a single scalar integer,
while the latter matches a vector of integers.
There is also the catch-all type t_any
,
which will match any value, and is useful for cases where
you want to allow any type of value for a field,
while still validating the other fields,
i.e. when .validation = TRUE
(the default).
Usage
t_any(.)
t_date(.)
t_dates(.)
t_int(.)
t_ints(.)
t_dbl(.)
t_dbls(.)
t_num(.)
t_nums(.)
t_char(.)
t_chars(.)
t_bool(.)
t_bools(.)
t_cplx(.)
t_cplxs(.)
t_raw(.)
t_raws(.)
t_factor(.)
t_factors(.)
t_list()
t_array()
t_vector(.)
t_matrix()
t_dataframe(x)
t_hashtab(x)
t_environment()
t_pairlist()
t_func()
t_expr()
t_call()
t_sym()
t_lang()
t_obj()
t_prim(x)
Examples
t_any
#> function (.)
#> TRUE
#> <bytecode: 0x55d6f4db3758>
#> <environment: namespace:RS>
#> attr(,"class")
#> [1] "ClassType" "t_any"
t_date
#> function (.)
#> .is_date(.) && length(.) == 1L
#> <bytecode: 0x55d6f4df6038>
#> <environment: namespace:RS>
#> attr(,"class")
#> [1] "ClassType" "t_date"
t_ints
#> function (.)
#> is.integer(.) && length(.) > 1L
#> <bytecode: 0x55d6f4e20150>
#> <environment: namespace:RS>
#> attr(,"class")
#> [1] "ClassType" "t_ints"
t_dataframe
#> function (x)
#> inherits(x, "data.frame")
#> <bytecode: 0x55d6f4e56550>
#> <environment: namespace:base>
#> attr(,"class")
#> [1] "ClassType" "t_dataframe"