You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
669B

  1. ```{r libs}
  2. library(tidyverse)
  3. # library(lubridate)
  4. ```
  5. # Tidy
  6. First the data are read from the flat file produced in the **Import** step.
  7. ```{r import}
  8. read_csv("Data/.csv") -> data
  9. ```
  10. This is where you would tidy your data.
  11. This shouldn't contain destructive transformation of data, just handling of types and obvious errors.
  12. ```{r tidy}
  13. data %>%
  14. select() %>%
  15. filter() %>%
  16. mutate() %>%
  17. mutate_if(is.character, factor) -> data
  18. ```
  19. The data are then exported in Rds to keep the formatting.
  20. You can export as many objects as you want, as long as they are inside a named list.
  21. ```{r export}
  22. list(data = data) %>%
  23. saveRDS(file = "Data/tidy.rds")
  24. ```