validateVec: validateVec

Description Usage Arguments Value Note Author(s) Examples

View source: R/validateVec.R

Description

This function return validate value that indicate variable that met the rule described by L param.

Usage

1
2
3
validateVec(x, L, method = c("ranges", "substrs", "elements")[1],
  mode = c("numeric", "character", "datetime")[1], type = c("fixed",
  "regex")[1], tsFormat = "ymd")

Arguments

x

is a vector which could be numeric, character or datetime type

L

is a expression ,eg:(0,10]),['a','c','b'],etc.

method

specified the method should be used

mode

is the mode of x

tsFormat

used to detect tsFormat in ts value

Value

logic value which could be T,F,NA

Note

the expression of L is flexible,like "(0,3)","[7,11]","[0,Inf)",c('[-1,0]','(1,10)'), "[2013-1-2,2-13-10-11]",c('apple','orange')

Author(s)

sontron

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x=rnorm(10)
L="[0,Inf]"
validateVec(x,L,method='ranges',mode='numeric')
x.char=c('a','b','cd')
L.char=c('a','c')
validateVec(x=x.char,L=L.char,method='elements',mode='character')
validateVec(x=x.char,L=L.char,method='substrs',mode='character')
Date=c('2016-1-1 14:24:00',NA,'2016-6-1','2016-12-31 24:00:00')
L.date='[2016-1-1,2016-12-31)'
validateVec(x=Date,L=L.date,method='ranges',mode='datetime')

sontron/madis documentation built on March 23, 2021, 10:17 p.m.