BaşlayınÜcretsiz Başlayın

Data frames and matrices - column selection

All values in a matrix must have the same data type, which has efficiency implications when selecting rows and columns.

Suppose we have two objects, mat (a matrix) and df (a data frame).

Bu egzersiz

Writing Efficient R Code

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

Using the microbenchmark() function, how long does it take to select the first column from each of these object? In other words, which is faster mat[, 1] or df[, 1]?

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Which is faster, mat[, 1] or df[, 1]? 
microbenchmark(___, ___)
Kodu Düzenle ve Çalıştır