Cheatography
https://cheatography.com
Select
Used to select specific columns from a data set.
To select a column -
Use the ":" sign to select a range of columns
Type in the specific column names to select individually
Use the "-" operator to exclude a column or a range of columns |
#Select individal columns
hflights_multiple <- select(hflights, ArrTime,AirTime,TaxiIn)
#Shortcut to select a range of columns
hflights_range <- select(hflights,Year:DayOfWeek,ArrTime:AirTime)
#Exclude a set of columns
hflights_subtract <- select(hflights, -(DayOfWeek:FlightNum)
|
|
Helper Functions
To search for column names, instead of typing each one manually or specifying range - we can use helper functions. These functions help us in making our work easier.
Common helper functions
ends_with("A")
starts_with("A")
contains("A")
matches("A")
num_range("A")
one_of("A")
|
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by shanly3011