R Data Frames
Cool functions
Basic dplyr
dplyr::filter(df, condition)- e.g.
dplyr::filter(df, age==10 & name=='yo')
- e.g.
dplyr::select(df, col_names)- e.g.
dplyr::select(df, age, -name)→ age but not name
- e.g.
dplyr::mutate(df, new_col_name = calculation_to_store)- e.g.
dplyr::mutate(df, age_plus_one = age + 1)
- e.g.
Pipes
%>%→ pipe operations together- e.g.
diamonds %>% filter (price > 100) %>% select(carat, price)- → df will automatically be inserted into next function, no need to supply it again
- e.g.