Skip to content
Snippets Groups Projects
Commit 7a5011c5 authored by Ruben van Dijk's avatar Ruben van Dijk
Browse files

Merge branch 'bugFixes' into 'master'

Fixed bug for times > 1 hour, small bugfix and one improvement

See merge request !15
parents 0a33c871 8a767ea9
Branches master
No related tags found
1 merge request!15Fixed bug for times > 1 hour, small bugfix and one improvement
Pipeline #8010 passed
......@@ -73,16 +73,17 @@ doId <- function(input) {
#wedstrijdtijden converteren naar duration
bron$time <- sub("M", "", bron$time) #weet niet wat die M betekend.
bron$lengte_tijd <- str_length(bron$time)
toe_te_voegen <- "00:"
gewenste_lengte <- 8
toe_te_voegen <- "0:00:"
gewenste_lengte <- 10
bron$toe_te_voegen <- str_sub(toe_te_voegen, end = (gewenste_lengte - bron$lengte_tijd))
bron$time <- str_c(bron$toe_te_voegen, bron$time)
bron <- subset(bron, select = -c(lengte_tijd, toe_te_voegen))
bron$minuten <- as.numeric(str_sub(bron$time, end = 2))
bron$seconden <- as.numeric(str_sub(bron$time, start = 4))
bron$tijdsduur <- duration(second = bron$seconden, minute = bron$minuten)
bron <- subset(bron, select = -c(minuten, seconden))
bron<-separate(bron, col='city', into=c("MeetId", 'city'), sep=" - ")
bron$uren<-as.numeric(str_sub(bron$time, end=1))
bron$minuten <- as.numeric(str_sub(bron$time, start=3, end=4))
bron$seconden <- as.numeric(str_sub(bron$time, start =6))
bron$tijdsduur <- duration(second = bron$seconden, minute = bron$minuten, hour=bron$uren)
bron <- subset(bron, select = -c(minuten, seconden, uren))
bron<-separate(bron, col='city', into=c("MeetId", 'city'), sep=" - ", fill='left')#avoid empty place if theres no MeetId
bron <-bron[order(bron$date),]
bron$city=trimws(gsub('\\s+', ' ',gsub("-|'", ' ', str_replace_all(bron$city, "\\s", " "))))
bron$city<-paste(toupper(substr(bron$city, 1, 1)), substr(bron$city, 2, nchar(bron$city)), sep="")
......@@ -150,13 +151,15 @@ doId <- function(input) {
tabel_LastEntrys<-zonder_split%>%
filter(Lap==FALSE)%>%
group_by(distance, stroke, poolType) %>%
filter(date == max(date, na.rm=TRUE))
filter(date == max(date, na.rm=TRUE))%>%
filter(tijdsduur==min(tijdsduur))#if you
#anders problemen als je meerdere keren hetzelfde zwemt op een dag. Misschien alleen als je verschillende heattypes hebt?
for (pooltype_loop in unique(tabel_LastEntrys$poolType)){
title_plot=paste("Last date swam - ", pooltype_loop, 'pool')
heatmap_lastswam=ggplot(tabel_LastEntrys[tabel_LastEntrys$poolType==pooltype_loop,],
aes(distance, stroke, text=date)) +
geom_tile(aes(fill = date)) + geom_text(aes(label = format(date, format="%e %b\n%Y")), size=4) +
geom_tile(aes(fill = date)) + geom_text(aes(label = format(date, format="%e %b\n%Y")), size=5) +
labs(title = title_plot)+ theme_bw()
heatmap_lastswam=ggplotly(heatmap_lastswam, tooltip=FALSE)%>%
layout(dragmode=FALSE)
......@@ -249,12 +252,12 @@ doId <- function(input) {
aes(x = date, y = tijdsduur, color = stroke)) +
labs(y = "Time", title = pooltype) +
geom_line() + geom_point(size=1)+
scale_y_time(labels = function(t) strftime(t, "%M:%S"))+
scale_y_time(labels = function(t) strftime(t, "%H:%M:%S"))+
scale_x_date(labels=function(t) strftime(t, datumformat))+
scale_colour_manual(values=kleurenset_strokes)+
facet_wrap(vars(distance), scales = 'free_y')
lijnenplot_gesplitst=ggplotly(lijnenplot_gesplitst, tooltip=c('x', 'y')) %>%
layout(dragmode=FALSE, legend=list(orientation='h'), yaxis = list(hoverformat = '%M:%S'))
layout(dragmode=FALSE, legend=list(orientation='h'), yaxis = list(hoverformat = '%H:%M:%S'))
appendPlotly(lijnenplot_gesplitst)
}
#LAPS compared to other
......@@ -263,7 +266,7 @@ doId <- function(input) {
shape=poolType, color=Lap, linetype=poolType))+
labs(y='Time')+
geom_line()+geom_point()+
scale_y_time(labels = function(t) strftime(t, "%M:%S"), minor_breaks=NULL)+
scale_y_time(labels = function(t) strftime(t, "%M:%S"), minor_breaks=NULL)+#Times >hour not expected
scale_x_date(labels=function(t) strftime(t, datumformat), minor_breaks=NULL)+
facet_grid(rows=vars(distance), cols=vars(stroke), scales='free_y')
plot_LAPtovNormal=ggplotly(plot_LAPtovNormal, tooltip=c('x', 'y'))%>%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment