isYear: isYear

View source: R/isYear.R

isYearR Documentation

isYear

Description

Function to find out whether a vector consists of strings in the format "yXXXX" or "XXXX" with X being a number

Usage

isYear(x, with_y = TRUE)

Arguments

x

A vector

with_y

indicates which dataformat years have to have (4-digit without y (e.g.1984) or 5digit including y (y1984))

Value

Returns a vector of the length of x with TRUE and FALSE

Author(s)

Benjamin Bodirsky

Examples


x <- c("1955", "y1853", "12a4")
isYear(x, with_y = TRUE)
isYear(x, with_y = FALSE)

magclass documentation built on May 29, 2024, 6:20 a.m.