Faire un calcul avec une variable date ou heure dans R
Catégorie du document
- Tutoriel
- Sites internet
Date du jour
15.08.2021
Catégorie
- Statistiques R
A retenir
f# Get sample of 'Date/Time Type'
x <- c("01:03:55", "01:03:57", "01:06:18", "01:09:33")
# Convert to proper format
y <- as.POSIXct(x, format = "%H:%M:%S")
# Find the median
y <- median(y)
# Updated, no need to use strsplit and sapply, directly use format
# ys <- strsplit(as.character(y), split = " ")
# sapply(ys, function(x) x[2])
# Get the time
format(y,"%H:%M:%S" )
[1] "01:05:07"
Lien vers l'article
https://stackoverflow.com/questions/51456491/r-calculating-median-value-from-time-data-series-returns-an-error