R-Ladies Sydney Profile picture
R-Ladies Sydney is part of a worldwide organisation promoting gender diversity in the R community. #rstats 🇦🇺

Aug 21, 2019, 12 tweets

Rebecca ⁦@rlbarter⁩ kicking off by showing how you can present R code from a jupyter notebook #Rstats 👍👍👍

Oooo nice shortcut select your code and then “command I” makes everything nicely aligned! #rstats

The tribble function is a handy way of making a df #rstats - not as handy as datapasta of course but still pretty handy

What is an anonymous function? It is just a function that doesn’t have a name defined. Like a function that you do on the fly. #rstats

the modify function will do the same as map but will simply return the same kind of thing as the input- that seems useful #rstats

Ooo good practice tips... read in the data as data_orig and then make another version called data, that way you always have the original in your environment #rstats

map_chr(df, class) is a nice alternative to str() or summary() to see the class of each variable #rstats

map_dbl(df, n_distinct) gets you how many unique values in each column- nice #Tatar’s

How did I not know about the pluck() function? E.g pluck(1) is the same as [[1]], but you can %>% it! #rstats

Dplyr bonus, distinct(v1 , v2) will give you all the distinct combinations of v1 and v2 #rstats

When using map2 with ggplot, you can glue a title to your plot with + ggtitle(glue::glue(.x, “ “, .y)) #rstats

One more hot tip ... the fancy %<>% will work like df <- df %>% ..... #rstats

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling