jDayColsTabs: jDayColsTabs

Description Usage Arguments Value Examples

View source: R/jDayColsTabs.R

Description

jDayColsTabs takes as input a character vector containing date.frame object names (dfNameVec), a character vector containing column names (dfColNameVec), and the date format (dateFormat) of the columns and inserts a new column in each data.frame object for each column in dfColNameVec containing the day of the year corresponding to the entries in that column in the original data.frame object. The location of the new column is dictated by endRep.

Usage

1
jDayColsTabs(dfNameVec, dfColNameVec, dateFormat, endRep = "end")

Arguments

dfNameVec

a data.frame object or a vector of class character indicating the name(s) of the data.frame object(s).

dfColNameVec

a string or a vector of class character indicating the name(s) of the column(s) to be handled. The entries in each of these columns are dates in the date format given by the parameter dateFormat.

dateFormat

a character string indicating the date format of the columns in dfColNameVec.

endRep

a character string (default: "end") indicating whether to append the new columns at the end (endRep=="end") or replace the original columns with the respective new columns (endRep=="rep") or insert the new columns right after the respective columns (endRep=="after") in the respective data.frame objects.

Value

jDayColsTabs updates the data.frame objects in dfNameVec by adding new columns containing the day of the year corresponding to the entries in the columns specified by dfColNameVec of the respective original data.frame objects. The entries in the new columns are integers in the range [1,366]

Examples

1
2
3
jDayColsTabs(c("rice","maize"),c("tillDate","plantDat","hrvDate"),"%d.%m.%Y")
jDayColsTabs(c("employees","students2"),c("date_of_birth","start_date"),"%Y-%m-%d",F)
jDayColsTabs("employees","date_of_birth","%Y-%m-%d")

lwTools/agriTrf documentation built on March 26, 2020, 12:09 a.m.