1

I want to read the data in the following url into R but I couldn't do it. Does anyone have any idea about it?? Thanks! http://web.stanford.edu/~hastie/ElemStatLearn/ I need the data Ozone

Prradep
  • 4,719
  • 3
  • 34
  • 66
crazystats
  • 23
  • 3
  • I would try right clicking the "data" link and downloading it as a text file. Then you could use read.table() with tab separators. – Conner Sexton Apr 25 '20 at 17:59

1 Answers1

0

The data is hosted at http://web.stanford.edu/~hastie/ElemStatLearn/datasets/ozone.data

The values are tab-separated, so you can read it using read_tsv from the readr package:

library(readr)
read_tsv("http://web.stanford.edu/~hastie/ElemStatLearn/datasets/ozone.data")

This will read the data directly from the website, so you won't need to download it manually yourself.

RyanFrost
  • 1,201
  • 5
  • 14
  • Thanks! But somehow when i tried to load the readr package, it gave me Error: package or namespace load failed for ‘readr’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): namespace ‘rlang’ 0.4.2 is already loaded, but >= 0.4.5 is required error message. But I couldn't update the package. Do you know why? – crazystats Apr 25 '20 at 18:22
  • Did you already try installing/updating the package with `install.packages("readr")`? – RyanFrost Apr 25 '20 at 18:29
  • Should I try updating R? – crazystats Apr 25 '20 at 18:33
  • Try `install.packages("rlang")` – RyanFrost Apr 25 '20 at 18:34
  • I installed rlang and tried to do library(readr) again but it gave me this error message:Error: package or namespace load failed for ‘readr’ in loadNamespace(j – crazystats Apr 25 '20 at 18:54
  • there is no package called ‘cli’............what is cli.....I didn't call a package called cli – crazystats Apr 25 '20 at 18:54
  • readr uses the package 'cli'. One more thing to try: `remove.packages("readr")`, then `install.packages("readr", dependencies = TRUE)` – RyanFrost Apr 25 '20 at 20:59
  • Thank you very much~~ – crazystats Apr 25 '20 at 21:34
  • You're welcome! Please consider accepting the answer (click the check mark) if it fixed your issue. Thanks! – RyanFrost Apr 25 '20 at 22:37