r - How to make boxplot for time format data? -


i have data frame 4 columns showing daylight in hours. need make boxplot compare different groups , take anova test comparing groups. here did not working.

              b            c       d 15:15:08    15:29:08    15:32:50    15:34:12 15:02:32    15:23:43    15:21:06    15:34:50 14:40:34    14:58:30    15:21:06    15:32:50 15:15:08    15:29:08    15:21:06    15:34:50 15:10:03    14:58:30    15:30:01    15:34:12 15:23:43    15:19:42    15:30:01    15:34:00 14:56:24    15:29:08    15:21:06    15:34:50 15:15:08    14:58:30    15:24:56    15:34:50 15:15:08    14:58:30    15:32:50    15:34:12 14:56:24    14:42:57    15:32:50    15:34:50 14:56:24    14:47:35    15:21:06    15:30:01 14:56:24    15:23:43    15:24:56    15:34:12 15:15:08    14:49:51    15:30:01    15:34:12 15:02:32    15:32:50    15:30:01    15:27:10 15:10:03    15:29:08    15:34:12    15:34:12  df<-as.posixct(df$a, format = "%h:%m:%s") df<-as.posixct(df$b, format = "%h:%m:%s") df<-as.posixct(df$c, format = "%h:%m:%s") df<-as.posixct(df$d, format = "%h:%m:%s")   boxplot(df) df.anova <- c(df$a, df$b, df$c, df$d) groups = factor(rep(letters[1:4], each = 15))  fit = lm(formula = df.anova~ groups) anova (fit) 

convert times hours using as.itime. plot boxplots , use pairwise t-tests compare groups. anova in r test means being equal, not need on occasion assume:

library(data.table) #convert hours df[] <- lapply(df, function(x) as.numeric(as.itime(x)) / 3600)  #boxplots boxplot(df)  #melt data.frame , calculate pairwise t.tests melteddf <- melt(df) pairwise.t.test(melteddf$value, melteddf$variable)  #pairwise comparisons using t tests pooled sd   #data:  melteddf$value , melteddf$variable  # #        b       c       #b 0.24228 -       -       #c 9.9e-06 0.00073 -       #d 4.1e-08 5.0e-06 0.24228  #p value adjustment method: holm  

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -