How to make a plot from summaryRprof?

This is a question for a university assignment.

I was given three algorithms for calculating the GCD, which I have already done. My problem is getting the Rprof results for the graph, so I can compare them side by side.

From the little understanding I have about Rprof, summaryRprof and plot is that Rprof is used as follows:

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

I understand that a graph has many different types of inputs, x and y values, and something called a data frame, which I assume is a fancy word for a table. and draw different lines and things that I need to use: http://www.harding.edu/fmccown/r/

that I can’t figure out how to get the summaryRprof results of the plot () function.

> 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????

, prorutool proftools, .

, , (system.time(gcdFunction (10 100)))

.

+3
2

gcd -, , R. , , .

summaryRprof() . summaryRprof("RProfOut2.out").

. , :

sumStats <- summaryRprof("RProfOut2.out")

4 :

> str(sumStats)
List of 4
 $ by.self        :'data.frame':    2 obs. of  4 variables:
  ..$ self.time : num [1:2] 1.97 0.25
  ..$ self.pct  : num [1:2] 88.7 11.3
  ..$ total.time: num [1:2] 1.97 0.25
  ..$ total.pct : num [1:2] 88.7 11.3
 $ by.total       :'data.frame':    3 obs. of  4 variables:
  ..$ total.time: num [1:3] 1.97 0.25 0
  ..$ total.pct : num [1:3] 88.7 11.3 0
  ..$ self.time : num [1:3] 1.97 0.25 0
  ..$ self.pct  : num [1:3] 88.7 11.3 0
 $ sample.interval: num 1e-04
 $ sampling.time  : num 2.22

, data.frames. ggplot2 , , , ... ggplot2. by.self() , :

require(ggplot2)

byself <- sumStats$by.self

byself$functions <- rownames(byself)

m <- melt(byself, id.var = "functions")

qplot(functions, value, data = m, fill = variable, geom = "bar", position = "dodge")

, : alt text

, , . , , :

Rprof("Rprof.out", interval = 0.0001)
x <- rnorm(10000000)
y <- x ^ 2
Rprof(NULL)
sumStats <- summaryRprof("Rprof.out")
+3

, Rprof:

Unix/OS X graphviz Perl script Romain Francois, R Wiki .

HPC R, , . .

+6

Source: https://habr.com/ru/post/1785578/


All Articles