DS4PS / cpp-526-spr-2021

Course shell for Foundations of Data Science I
https://ds4ps.org/cpp-526-spr-2021/
MIT License
1 stars 2 forks source link

Code-Through Question - database #18

Open sandralili opened 3 years ago

sandralili commented 3 years ago

Hello,

I am using a COVID dataset that I found in https://ourworldindata.org/coronavirus-source-data I downloaded it and works great except when I need to knit the file.

image

This is the error:

image

I also tried to use a URL trying to call the dataset directly from the website and did not work either. Could you please help me?

Thanks!

jamisoncrawford commented 3 years ago

Your error message is just telling you that it can't find the object covid_data in your script. At some point, you call function head() with covid_data but since covid_data isn't created or defined in your script, R doesn't know where it is. In this case, just use Ctrl + F and find where head(covid_data) is called - then erase or update that code.

Here's the URL for downloading the COVID data:

https://covid.ourworldindata.org/data/owid-covid-data.csv

What you can do to read this in at the beginning of your script is the following:

library(readr)

url <- "https://covid.ourworldindata.org/data/owid-covid-data.csv"

covid_data <- read_csv(url)

Give this a try and let us know how it goes!

sandralili commented 3 years ago

Thanks, Professor @jamisoncrawford It worked! Thank you!!