Show Menu

Data manipulation in R : dplyr Cheat Sheet by

r     dplyr     datamanipulation

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 indivi­dually
Use the "­-" operator to exclude a column or a range of columns
#Select individal columns
hflig­hts­_mu­ltiple <- select­(hf­lights, ArrTim­e,A­irT­ime­,Ta­xiIn)

#Shortcut to select a range of columns
hflig­hts­_range <- select­(hf­lig­hts­,Ye­ar:­Day­OfW­eek­,Ar­rTi­me:­Air­Time)

#Exclude a set of columns
hflig­hts­_su­btract <- select­(hf­lights, -(DayO­fWe­ek:­Fli­ght­Num)
 

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_­wit­h("A­")
start­s_w­ith­("A")
conta­ins­("A")
match­es(­"­A")
num_r­ang­e("A­")
one_o­f("A­")

Download the Data manipulation in R : dplyr Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/shanly3011_data-manipulation-in-r-dplyr.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          iGraph Cheat Sheet

          More Cheat Sheets by shanly3011