Sarah Cassie Burnett
September 16, 2025
unvotes)Tidy data is data that can use the packages of the tidyverse
There are four basic principles to a tidy API:
unvotes)read_csv() function from readr packagereadr package is part of the tidyverse<- is the assignment operator
# is the comment operator
library() and name of library
library(readr)install.packages("readr")Use glimpse() to see the columns and data types:
# load libraries
library(readr)
library(dplyr)
films <- read_csv("data/film_cleanish.csv")
glimpse(films)Rows: 1,659
Columns: 9
$ Year <dbl> 1990, 1991, 1983, 1979, 1978, 1983, 1984, 1989, 1985, 199…
$ Length <dbl> 111, 113, 104, 122, 94, 140, 101, 99, 104, 149, 188, 117,…
$ Title <chr> "Tie Me Up! Tie Me Down!", "High Heels", "Dead Zone, The"…
$ Genre <chr> "Comedy", "Comedy", "Horror", "Action", "Drama", "Action"…
$ `Lead Man` <chr> "Banderas, Antonio", "Bosé, Miguel", "Walken, Christopher…
$ `Lead Woman` <chr> "Abril, Victoria", "Abril, Victoria", "Adams, Brooke", "A…
$ Director <chr> "Almodóvar, Pedro", "Almodóvar, Pedro", "Cronenberg, Davi…
$ Popularity <dbl> 68, 68, 79, 6, 14, 68, 14, 28, 6, 32, 81, 17, 46, 49, 6, …
$ Awards <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, F…
Or use View() or click on the name of the object in your Environment tab to see the data in a spreadsheet:
Now try writing the same data to a file with a different name
googlesheets4gs4_deauth() to authenticateread_sheet() to read in the data05:00
glimpse() and View()05:00