jDayCol: jDayCol

Description Usage Arguments Value Examples

View source: R/jDayCol.R

Description

jDayCol takes as input a date.frame object or a data.frame object name (dfData), a column name (dfColName), and the date format (dateFormat) of the column dfColName and inserts a new column in the data.frame object containing the day of the year corresponding to the entries in the column dfColName. The location of the new column is dictated by endRep.

Usage

1
jDayCol(dfData, dfColName, dateFormat, endRep = "end")

Arguments

dfData

a data.frame object or a character string indicating the name of the data.frame object.

dfColName

a string of class character indicating the name of the column to be handled. The entries in this column must be dates in the date format given by the parameter dateFormat

dateFormat

a character string indicating the date format of the column dfColName

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 data.frame object dfData.

Value

jDayCol updates the data.frame object dfData by adding a new column containing the day of the year corresponding to the entries in column dfColName of the original data.frame object. The entries in the new column are integers in the range [1,366]

Examples

1
2
jDayCol("employees","start_date","%Y-%m-%d")
jDayCol(students,"date_of_birth","%d.%m.%Y",F)

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