ez.is.date.like: check if a vector of char, number is convertiable to date...

View source: R/basic.R

ez.is.date.likeR Documentation

check if a vector of char, number is convertiable to date type

Description

check if a vector of char, number is convertiable to date type as.Date(as.character(x), format)

Usage

ez.is.date.like(x, format = "%m/%d/%Y", ...)

Arguments

x

a vector of char, number

format

specify date format. see examples

...

other parameters passed to as.Date(...)

Value

returns a vector of T/F (vectorized because of is.na() used).

See Also

ez.date ez.is.date ez.is.date.like ez.age ez.time

Examples

mydate = c("10/11/2012","10-12-2012", 345)
# format one of c("%d/%m/%Y", "%d-%m-%Y", "%Y/%m/%d", "%m/%d/%Y", "%Y-%m-%d"). %y for two year digits
ez.is.date.like(mydate, format = "%m/%d/%Y")  # T F F

jerryzhujian9/zmisc documentation built on March 9, 2024, 12:49 a.m.