type fun mean 1 Month for_if 3.252180e-01 2 Month for_if_else 3.054237e-01 3 Month for_ifelse 5.160331e-01 4 Month for_switch 9.307517e-02 5 Month which 3.935091e-01 6 Month str_replace_all 3.372382e+00 7 Month join 2.467942e+00 8 Month ddply.parallel 7.441605e+01 9 Month ddply 9.836038e+00 10 result for_if 9.601528e-01 11 result for_if_else 8.065160e-01 12 result for_ifelse 1.007159e+00 13 result for_switch 7.728128e-01 14 result which 8.868605e-01 15 result str_replace_all 4.431068e+00 16 result join 2.523177e+00 17 result ddply.parallel 1.939038e+01 18 result ddply 1.924074e+01 19 Season for_if 3.223124e-01 20 Season for_if_else 2.256315e-01 21 Season for_ifelse 3.162032e-01 22 Season for_switch 8.748225e-02 23 Season which 1.571115e-01 24 Season str_replace_all 8.145484e+01 25 Season join 3.546876e+00 26 Season ddply.parallel 7.299754e+01 27 Season ddply 9.877732e+00
#根據上述數據生成圖 data<-read.csv("/home/xh/300G/筆記/R/Book1.csv",) ggplot(data,aes(fun,mean,fill=type))+ geom_col()+ facet_wrap(~type)+ theme(axis.text.x = element_text(angle=90),legend.position="none") coord_flip()
從上圖能夠看出,tidyverse包中的這幾個函數(ddply*,str_repalce_all, join)花費的時間都明顯長,而R自帶的基本函數花費時間較短。java
本結果是基於隨機的10個月數據統計的結果,其結果具備很大的隨機性shell
本結果執行的平臺信息爲:函數
more /proc/cpuinfo | grep "model name" #CPU grep MemTotal /proc/meminfo #內存 lsb_release -a #操做系統
model name : Intel(R) Core(TM) i3-2328M CPU @ 2.20GHz model name : Intel(R) Core(TM) i3-2328M CPU @ 2.20GHz model name : Intel(R) Core(TM) i3-2328M CPU @ 2.20GHz model name : Intel(R) Core(TM) i3-2328M CPU @ 2.20GHz MemTotal: 10043876 kB LSB Version: n/a Distributor ID: ManjaroLinux Description: Manjaro Linux Release: 18.1.5 Codename: Juhraya
(未完!待續……)ui