gpt4 book ai didi

r - 如何从 summaryRprof 中绘制图表?

转载 作者:行者123 更新时间:2023-12-04 12:06:58 24 4
gpt4 key购买 nike

这是一个大学作业的问题。

给了我三个算法来计算我已经做过的 GCD。我的问题是将 Rprof 结果绘制成图表,以便我可以并排比较它们。

根据我对 Rprof、summaryRprof 和 plot 的一点了解,Rprof 是这样使用的:

Rprof() #To start
#functions here
Rprof(NULL) #TO end
summaryRprof() # to print results

我知道 plot 有许多不同类型的输入、x 和 y 值以及称为数据框的东西,我认为它是表的一个花哨的词。并绘制不同的线条和我需要使用的东西:http://www.harding.edu/fmccown/r/

我想不通的是如何将 summaryRprof 结果传递给 plot() 函数。

> Rprof(filename="RProfOut2.out", interval=0.0001)
> gcdBruteForce(10000, 33)
[1] 1
> gcdEuclid(10000, 33)
[1] 1
> gcdPrimeFact(10000, 33)
[1] 1
> Rprof(NULL)
> summaryRprof()
?????plot????

我一直在阅读有关堆栈溢出的内容以及其他我也可以尝试使用 profr 和 proftools 的网站,尽管我对用法不是很清楚。

我能够制作的唯一图表是使用 plot(system.time(gcdFunction(10,100)))

一如既往地感谢任何帮助。

最佳答案

有两个可视化Rprof输出的包:

在安装了 graphviz 的 Unix/OS X 系统上,您可以使用由 Romain Francois 编写的精美 Perl 脚本,该脚本位于 R Wiki page on profiling。 .

所有这些都通过我的 Intro to HPC with R 教程中的示例进行了描述,您可以找到例如here .

关于r - 如何从 summaryRprof 中绘制图表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4697835/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com