Learn R Programming

healthcareai (version 1.2.4)

orderByDate: Order the rows in a data frame by date

Description

Returns a data frame that's ordered by its date column

Usage

orderByDate(df, dateCol, descending = FALSE)

Arguments

df

A data frame

dateCol

Name of column in data frame that contains dates

descending

Boolean for whether the output should be in descending order

Value

A data frame ordered by date column

References

http://healthcareai-r.readthedocs.io

See Also

healthcareai

Examples

Run this code
# NOT RUN {
df <- data.frame(date=c('2009-01-01','2010-01-01','2009-03-08','2009-01-19'),
                a=c(1,2,3,4))
dfResult <- orderByDate(df,'date', descending=FALSE)
head(dfResult)
# }

Run the code above in your browser using DataLab