add_daynight: Adds day or night to a dataframe.

Description Usage Arguments Value Examples

View source: R/add_daynight.R

Description

DEPENDENT function: Dependent on add_datetime and is_daynight support functions This function adds a single column of day or night to all rows of a given dataframe. This function builds on and is dependent on the add_datetime package. How it works is this funciton grabs the time values in the dataframe and determines if it is night or day by seeing if the hour element is above or below 12. If there is already a day_or_night or time column, the function will print an error message.

Usage

1

Arguments

df

dataframe

Value

dataframe

Examples

1
2
3
4
5
6
fruit_harvest <- data.frame(apples = c(4,10,12), oranges = c(8,9,10))
add_daynight(df)
##   apples oranges       date     time day_or_night
## 1      4       8 2015-11-26 23:47:15        night
## 2     10       9 2015-11-26 23:47:15        night
## 3     12      10 2015-11-26 23:47:15        night

hochoy/r_timekeeper documentation built on May 17, 2019, 4:36 p.m.