HI, I am trying to analyze data and I have not been able to find the answer anywhere. My data looks like below:
#> sample dataset below
df <- data.frame(
site = c(1, 2, 2, 3, 3, 3, 4),
time.spent = c("05:00", "12:00", "06:43", "02:00", "17:00", "09:45", "06:00"),
emissions = c(1.2, 3.6, 2.4, 9.6, 1.8, 5.3, 1.6))
#> this is what I ran
library(ddply)
emit <- ddply (df, c("site"), summarize,
emission = sum (emissions, na.rm=T),
Time = mean (time.spent, na.rm=T))
what I want to do is get a summary by site on average time and emissions
However, I am not able to run it as the time.spent variable is in character or factor format. If I try to change it to numeric - it does not covert from 06:00 to 6 but instead picks a random number and gives 5, or for 29:00 gives 17.
I have searched and searched - so please help me. even tried strptime package and other stuff. Hoping someone here can help me out now!