Skip to content
Snippets Groups Projects
Commit a97e9aa0 authored by Berinda van Dijk's avatar Berinda van Dijk
Browse files

Some changes in code format, and every city now starts with an uppercase letter.

parent e04e0bca
Branches
No related tags found
1 merge request!13Support for laptimes
......@@ -41,11 +41,13 @@ doId <- function(input) {
bron$poolType <- as.factor(bron$poolType)
bron=bron[order(bron$stroke, bron$distance),]
bron$AfstandSlag<-factor(bron$AfstandSlag, ordered=TRUE, levels=unique(bron$AfstandSlag))
#Wat als iets niet in kleurenset_afstanden valt?
kleurenset_afstanden=c('25'='red', '50'='orange', '100'='yellow', '200'='green', '400'='blue', '800'='purple', '1500'='deeppink1','500'='black')
kleurenset_strokes=c('Backstroke'='red', "Breaststroke"='orange', "Butterfly"="purple", "Freestyle"="green", "Medley"="blue")
kleurenset_pooltypes=c('25m'='orchid', '50m'='cornflowerblue', 'OW'='limegreen')
kleurenset_Pbs=c('Pb'='maroon1', 'noPb'='black')
bron=separate(bron, col = heatType, into = c("hoofdafstand", "heatType"), sep = ", ", fill='left')
bron$heatType <- as.factor(bron$heatType)
......@@ -72,6 +74,7 @@ doId <- function(input) {
bron<-separate(bron, col='city', into=c("MeetId", 'city'), sep=" - ")
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="")
zonder_split <- bron[bron$ranking != "Split",]
bovennul<-zonder_split[zonder_split$points !=0,]
......@@ -99,7 +102,7 @@ doId <- function(input) {
Plot_CountsParAfstandSlag_dates<-ggplotly(Plot_CountsParAfstandSlag_dates, dynamicTicks=TRUE, tooltip=c('x', 'y', 'text'))
appendPlotly(Plot_CountsParAfstandSlag_dates)
tabel_Prs <- bovennul %>%
tabel_Prs_metpooltype <- bovennul %>%
group_by(distance, stroke, poolType) %>%
filter(points == max(points, na.rm = TRUE)) %>%
filter(time == min(time, na.rm=TRUE))
......@@ -117,15 +120,15 @@ doId <- function(input) {
'<br>', '<sup>', 'rose: Pbs (inclusive timed disqualifications, exlusive split-times)','</sup>')))
appendPlotly(tijdlijn_alles)
tabel_Prs_small <- bovennul %>%
tabel_Prs_zonderpooltype <- bovennul %>%
group_by(distance, stroke) %>%
filter(points == max(points, na.rm = TRUE)) %>%
filter(time == min(time, na.rm=TRUE))
heatmap_prs <- ggplot(tabel_Prs_small, aes(distance, stroke, text=date)) +
heatmap_prs <- ggplot(tabel_Prs_zonderpooltype, aes(distance, stroke, text=date)) +
geom_tile(aes(fill = points)) +
geom_text(aes(label = points), size=7) +
labs(title = "Heatmap punten per slag en afstand") +
labs(title = "Heatmap punten per slag en afstand. Geen laptijden.") +
theme_bw()
heatmap_prs<-ggplotly(heatmap_prs, tooltip=c('text'))%>%layout(dragmode=FALSE)
appendPlotly(heatmap_prs)
......@@ -145,7 +148,7 @@ doId <- function(input) {
plottabel_LastSwam<-plottabel_LastSwam %>% layout(title='Last swam par distance and pooltype')
appendPlotly(plottabel_LastSwam)
breedte_perslag=unique(tabel_Prs[, c('distance', 'stroke')]) %>% group_by(stroke) %>%count()
breedte_perslag=unique(tabel_Prs_metpooltype[, c('distance', 'stroke')]) %>% group_by(stroke) %>%count()
breedte_perslag=breedte_perslag$n
breedte_perslag=breedte_perslag/(breedte_perslag%>%sum())
......@@ -159,16 +162,15 @@ doId <- function(input) {
facet_wrap(.~stroke, scales='free_x'),
tooltip=c('x', 'y', 'label', 'text'))}
facetwrap_prs=tabel_Prs[order(tabel_Prs$poolType),] %>% split(.$stroke) %>%map(barplot_facets)
facetwrap_prs=tabel_Prs_metpooltype[order(tabel_Prs_metpooltype$poolType),]%>% split(.$stroke) %>%map(barplot_facets)
facetwrap_prs=facetwrap_prs %>% subplot(widths=breedte_perslag, margin=0.01, shareY=TRUE) %>%
layout(showlegend=FALSE, dragmode=FALSE, title='Prs')
appendPlotly(facetwrap_prs)
tabel_lasts=tabel_LastEntrys[order(tabel_LastEntrys$poolType),]
tabel_lasts=tabel_lasts[tabel_lasts$points!=0,]
tabel_lasts=tabel_LastEntrys[order(tabel_LastEntrys$poolType),]%>%filter(points!=0)
facetwrap_lasts=tabel_lasts %>% split(.$stroke) %>%map(barplot_facets)
facetwrap_lasts=facetwrap_lasts %>% subplot(widths=breedte_perslag, margin=0.01, shareY=TRUE) %>%
layout(showlegend=FALSE, dragmode=FALSE, title='Last entrys')
layout(showlegend=FALSE, dragmode=FALSE, title='Last entrys. Points >0, so no laptimes, 25m-times, disqualifiactions etc.')
appendPlotly(facetwrap_lasts)
stippenplot_sizes<-ggplot(bovennul, aes(x=date, y=points, color=stroke, size=distance, group=AfstandSlag))+
......@@ -195,7 +197,7 @@ doId <- function(input) {
naam_laatstgezien=goede_naam}
appendPlotly(lijnenplot_ineen)
for (pooltype_loop in c('25m', '50m')){
for (pooltype_loop in unique(bovennul$poolType)){
title_plot=paste("Points - ", pooltype_loop, 'pool')
lijnenplot_pooltype=ggplot(bovennul[bovennul$poolType==pooltype_loop,],
aes(x = date, y = points, text=AfstandSlag,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment