Aan de slagGa gratis aan de slag

Object type conversion

Some object types can be converted from one class to another class. For this exercise you will select and convert variables in the abaloneMod dataset from one class type to another. The previous abaloneMod dataset and dplyr package is also loaded for you.

Deze oefening maakt deel uit van de cursus

R For SAS Users

Cursus bekijken

Oefeninstructies

  • Convert adult to numeric using as.numeric(), then confirm its class type.
  • Select the three abalone dimensions: length, diameter and height from abaloneMod and save them in a new object called abalonedim.
  • Convert abalonedim to a matrix and confirm its class type.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Convert adult to numeric then confirm class type
abaloneMod %>% 
  ___ %>% 
  ___ %>% 
  ___

# Select three dimensions, save as abalonedim
abalonedim <- ___ %>%
  ___

# Convert abalonedim to a matrix and confirm class type
abalonedim %>% 
  ___ %>% 
  ___
Code bewerken en uitvoeren