Importing data

Author

Jeffrey R. Stevens

Published

February 8, 2023

  1. Download https://jeffreyrstevens.quarto.pub/dpavir/data/newdata.csv and save it in your data/ directory.

  2. Import newdata.csv and name it newdata using read.csv().

newdata <- read.csv(here::here("data/newdata.csv"))
  1. Import https://jeffreyrstevens.quarto.pub/dpavir/data/newdata2.csv directly from the URL using readr::read_csv().
library(readr)
newdata2 <- read_csv("https://jeffreyrstevens.quarto.pub/dpavir/data/newdata2.csv")
Rows: 198 Columns: 11
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): Breed, links, Image
dbl (8): X2013.Rank, X2014.Rank, X2015.Rank, X2016.Rank, X2017.Rank, X2018.R...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
  1. Repeat the previous import of newdata2.csv, but add the arguments col_select = c("Breed", "links") and show_col_types = FALSE and name it newdata3.
newdata3 <- read_csv("https://jeffreyrstevens.quarto.pub/dpavir/data/newdata2.csv", col_select = c("Breed", "links"), show_col_types = FALSE)
  1. Export the newdata3 data as a CSV file to your data/ directory.
write_csv(newdata3, here::here("data/newdata3.csv"))