How to make a plot from summaryRprof?

Posted by ThorDivDev on Stack Overflow See other posts from Stack Overflow or by ThorDivDev
Published on 2011-01-15T03:39:41Z Indexed on 2011/01/15 4:53 UTC
Read the original article Hit count: 151

Filed under:

This is a question for an university assignment.

I was given three algorithms to calculate the GCD that I already did. My problem is getting the Rprof results to a plot so I can compare them side by side.

From what little understanding I have about Rprof, summaryRprof and plot is that Rprof is used like this:

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

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

what I cant figure out is how to get the summaryRprof results to 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????

I have been reading on stack overflow that and other sites that I can also try to use profr and proftools although I am not very clear on the usage.

The only graph I have been able to make is one using plot(system.time(gcdFunction(10,100)))

As always any help is appreciated.

© Stack Overflow or respective owner

Related posts about r