1. R语言运行效率分析_小结(1)

小结(1)

上述9种方法(10个月份)转换“月和季的英文名称”所花时间结果整理如下:
     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自带的基本函数花费时间较短。

说明

本结果是基于随机的10个月数据统计的结果,其结果具有很大的随机性

本结果执行的平台信息为:

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

(未完!待续……)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值