ComenzarEmpieza gratis

Selecting columns

Often it is convenient to work with only a certain column or a subset of columns of a bigger data frame. There are many ways to select columns of data frame in R and you saw one of them in the previous exercise: select() from dplyr*.

dplyr is a popular library for data wrangling. There is also a convenient data wrangling cheatsheet by RStudio to help you get started.

Este ejercicio forma parte del curso

Helsinki Open Data Science

Ver curso

Instrucciones del ejercicio

  • Access the dplyr library
  • Create object keep_columns
  • Use select() (possibly together with one_of()) to create a new data frame learning2014 with the columns named in keep_columns.
  • Look at the structure of the new dataset

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# lrn14 is available

# access the dplyr library
library(dplyr)

# choose a handful of columns to keep
keep_columns <- c("gender","Age","attitude", "deep", "stra", "surf", "Points")

# select the 'keep_columns' to create a new dataset
learning2014 <- "change me!"

# see the stucture of the new dataset

Editar y ejecutar código