Have a server log file and I want to do some analysis like the number of hits on a method and time range for those hits.
So I am using RStudio to achieve that:
DateTime,Method
5/8/2020 0:00:00, Login
5/8/2020 2:00:00, Logout
5/8/2020 4:00:00, Login
5/8/2020 6:00:00, Login
5/8/2020 8:00:00, Login
5/8/2020 1:00:00, Logout
5/8/2020 9:00:00, Login
5/8/2020 5:00:00, Login
5/8/2020 10:00:00, Login
5/8/2020 5:00:00, Logout
5/8/2020 6:00:00, Logout
So I need output like this
MinDateTime MaxDateTime,Hits
Login 5/8/2020 0:00:00,5/8/2020 10:00:00,7
Logout 5/8/2020 1:00:00,5/8/2020 10:00:00,4
Here is the code that generates the df.
df <- data.frame(
DateTime = c(
"5/8/2020 0:00:00", "5/8/2020 2:00:00", "5/8/2020 4:00:00",
"5/8/2020 6:00:00", "5/8/2020 8:00:00", "5/8/2020 1:00:00",
"5/8/2020 9:00:00", "5/8/2020 5:00:00", "5/8/2020 10:00:00",
"5/8/2020 5:00:00", "5/8/2020 6:00:00"),
Method = c(
"Login", "Logout", "Login",
"Login", "Login", "Logout",
"Login", "Login", "Login",
"Logout", "Logout")
)
Thanks