is there any way to transform output of function microbenchmark::microbenchmark
into the data frame or matrix?
For example
v <- rnorm(100)
m <- microbenchmark(mean(v), sum(v))
The output
Unit: nanoseconds
expr min lq mean median uq max neval
mean(v) 6568 6979.5 9348.19 7390 7390 54600 100
sum(v) 0 1.0 353.57 411 411 8211 100
I want to use this statistics later so I thought about saving the result as data frame. But as.data.frame(m)
doesn't work.
Any help appreciated.
This will return a data.frame:
summary(m)
You can save m
as a dataframe with the following code:
m <- summary(microbenchmark(mean(v), sum(v))) #note the addition of summary
m.df<- data.frame(m)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With