May 26, 2021

  • The forcats package (for categories) in R has functions that can be viewed by typing ?fct_ at the console prompt. This will create a drop down list of all the functions starting with fct_
 
  • forcats is basically the equivalent of doing an aggregation in Elasticsearch. fct_reorder() will categorize a character vector and sort them by the median of the second variable. For example, in the chickwts dataset, you can categorize by the feed type and arrange those feed types by the median of chick weights. 
chickwts %>%
     mutate(newfeed = fct_reorder(feed, weight)) %>%
     ggplot(., aes(newfeed,weight)) +
     geom_point()
  • You can find the day of the week from a date with wday(ymd("1929-12-15")). Alternately, you can change the order for the month and day as long as you specify the change in order with 'ydm'. wday(ydm(1929-15-12")). 
  • Chatham House Rule - anyone who attends a meeting is free to use information in the discussion, but is not allowed to reveal who made any comment. It is designed to increase the openness of discussion. Named in 1927 after the Chatham House in London, the headquarters of the UK Royal Institute of International Affairs. 
  • A file with an .rda extension is an R data file that can be opened with a load command. 
health_case_study <- load(file="case_study_1.rda")
Comments are closed

PageList

MonthList