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

Recode variables

This exercise picks up where you left off in the previous exercise. In this exercise you will continue to modify your abaloneMod dataset by adding more variables.

Specifically, you will recode the new age variable into two ordinal categories split at the median. You will also create a new variable adult to identify the abalones that are immature infants (i.e. sex = "I") from the adults (sex = "F" or "M").

At the end you will view these new variables and compare them to the original variables to check your recoding results. The previous abaloneMod dataset and dplyr package have been loaded for you.

Bu egzersiz

R For SAS Users

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

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Add new character variable agecat to abaloneMod
abaloneMod <- abaloneMod %>%
  mutate(agecat = ifelse(test = ___, 
                         yes = ___, 
                         no = ___))
Kodu Düzenle ve Çalıştır