Row timings
Similar to the previous example, the objects mat and df are a matrix and a data frame, respectively. Using microbenchmark(), how long does it take to select the first row from each of these objects?
To make the comparison fair, just use mat[1, ] and df[1, ].
Diese Übung ist Teil des Kurses
<Kurs>Writing Efficient R Code</Kurs>Übungsanweisungen
The microbenchmark package is already loaded in your workspace.
Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Which is faster, mat[1, ] or df[1, ]?
microbenchmark(___, ___)