View source: R/convertHoursAMPM.R
convertHoursAMPM | R Documentation |
Convert hours to 24-hour time.
convertHoursAMPM(hours, ampm, am = 0, pm = 1, treatMorningAsLate = FALSE)
hours |
The vector of times in hours. |
ampm |
Vector indicating whether given times are AM or PM. |
am |
Value indicating AM in |
pm |
Value indicating PM in |
treatMorningAsLate |
|
Convert hours to the number of hours in 24-hour time. You can specify whether to treat morning hours (e.g., 1 AM) as late (25 H), e.g., for specifying late bedtimes
Hours in 24-hour-time.
Other times:
convertToHours()
,
convertToMinutes()
,
convertToSeconds()
Other conversion:
convert.magic()
,
convertToHours()
,
convertToMinutes()
,
convertToSeconds()
,
percentileToTScore()
,
pom()
# Prepare Data
df1 <- data.frame(hours = c(1, 1, 12, 12), ampm = c(0, 0, 1, 1))
df2 <- data.frame(hours = c(1, 1, 12, 12), ampm = c(1, 1, 0, 0))
# Convert AM and PM hours
convertHoursAMPM(hours = df1$hours, ampm = df1$ampm)
convertHoursAMPM(hours = df1$hours, ampm = df1$ampm,
treatMorningAsLate = TRUE)
convertHoursAMPM(hours = df2$hours, ampm = df2$ampm, am = 1, pm = 0)
convertHoursAMPM(hours = df2$hours, ampm = df2$ampm, am = 1, pm = 0,
treatMorningAsLate = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.