Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go

Selecting Columns

20200317

Columns from a data frame can be dplyr::select()'ed simply by listing the column names. The columns in the resulting data frame will be in the same order as they are listed in the function call.

ds %>%
  select(date, location, min_temp, temp_9am, temp_3pm, max_temp)
## # A tibble: 176,747 x 6
##    date       location min_temp temp_9am temp_3pm max_temp
##    <date>     <chr>       <dbl>    <dbl>    <dbl>    <dbl>
##  1 2008-12-01 Albury       13.4     16.9     21.8     22.9
##  2 2008-12-02 Albury        7.4     17.2     24.3     25.1
##  3 2008-12-03 Albury       12.9     21       23.2     25.7
##  4 2008-12-04 Albury        9.2     18.1     26.5     28  
##  5 2008-12-05 Albury       17.5     17.8     29.7     32.3
##  6 2008-12-06 Albury       14.6     20.6     28.9     29.7
##  7 2008-12-07 Albury       14.3     18.1     24.6     25  
##  8 2008-12-08 Albury        7.7     16.3     25.5     26.7
##  9 2008-12-09 Albury        9.7     18.3     30.2     31.9
## 10 2008-12-10 Albury       13.1     20.1     28.2     30.1
## # ... with 176,737 more rows


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.