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

Using .SD (II)

You can also apply a single function to every column specified in .SDcols using lapply(). In this exercise, you will calculate the number of unique start stations and zip codes for each month using uniqueN(). uniqueN() returns the number of unique elements in a column/vector/data.table.

Bu egzersiz

Data Manipulation with data.table in R

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

Egzersiz talimatları

Find the total number of unique start stations and zip codes for each month, using start_date to extract the month.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Find the total number of unique start stations and zip codes per month
unique_station_month <- batrips[, ___(___, ___), 
                                by = ___, 
                                .SDcols = c("start_station", "zip_code")]
unique_station_month
Kodu Düzenle ve Çalıştır