Use a single to introduce ordinary comments and separate comments from code with a single empty line before and after the comment. Comments should be full sentences beginning with a capital and ending with a full stop.


# How many locations are represented in the dataset.

ds$location %>% unique() %>% length()

# Identify variables that have a single value.

ds[vars] %>%
  sapply(function(x) all(x == x[1L])) %>%
  which() ->

Sections might begin with all uppercase titles and subsections with initial capital titles. The last four dashes at the end of the comment are a section marker supported by RStudio. Other conventions are available for structuring a document and different environments support different conventions.



# Normalise Variable Names ----

# Review the names of the dataset columns.


# Normalise variable names and confirm they are as expected.

ds %<>% dplyr::rename\_all(rattle::normVarNames)

# Wrangle weatherAUS ----

# Convert the character variable 'date' to a Date data type.

ds$date %<>%
  lubridate::ymd() %>%
  as.Date() %T>%
  {class(.); print()}

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0