Transcription of Data transformation with dplyr : : CHEAT SHEET
{{id}} {{{paragraph}}}
Data transformation with dplyr : : CHEAT SHEET . dplyr functions work with pipes and expect tidy data. In tidy data: A B C A B C. Manipulate Cases Manipulate Variables &. pipes EXTRACT CASES EXTRACT VARIABLES. Row functions return a subset of rows as a new table. Column functions return a set of columns as a new vector or table. Each variable is in Each observation, or x %>% f(y). its own column case, is in its own row becomes f(x, y) filter(.data, , .preserve = FALSE) Extract rows pull(.data, var = -1, name = NULL, ) Extract Summarise Cases w www ww that meet logical criteria. filter(mtcars, mpg > 20) w www column values as a vector, by name or index. pull(mtcars, wt). distinct(.data, , .keep_all = FALSE) Remove select(.data, ) Extract columns as a table. w www Apply summary functions to columns to create a new table of w www ww rows with duplicate values.
mutate() and transmute() apply vectorized functions to columns to create new columns. Vectorized functions take vectors as input and return vectors of the same length as output. Vectorized Functions TO USE WITH MUTATE vectorized function Summary Functions TO USE WITH SUMMARISE summarise() applies summary functions to
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}