Working on my own side project, I have a smaller dataframe containing only 2 columns that was subsetted from a larger dataframe.
The 2 columns I am working on is "Lap.." and "Timestamp..s.".
I want to get the minimum timestamp and maximum timestamp from a specific lap number.
Right now my focus is having a hard coded value for the specific lap number.
Here is my code:
time_df <- csv_to_Table[c("Lap..", "Timestamp..s." )]
#output data to csv to make sure that it is correct
write.csv(time_df, file = "data/lap_timestamp.csv")
output$time_test <- renderText({
max(time_df$Timestamp..s.) - min(time_df$Timestamp..s.)
})
The above code will display the total time that I was driving on the track.
However, when I read the max and min documentation it doesn't mention about having an extra criteria to filter on. Seeing dplyr library does contain a filter, I gave it a try, but still no luck.
output$time_test <- renderText({
(max(time_df$Timestamp..s.) %>% filter(time_df$Lap.. == 1)) - (min(time_df$Timestamp..s.) %>% filter(time_df$Lap.. == 1))
})
Test data is located here: https://pastebin.com/GZvWEcXb
In the future I will want to move to having a dropdown for the lap number.
Any help/hint is appreciated.