Home > Net >  Error with reading csv from URL: Error in functionalert protocol version
Error with reading csv from URL: Error in functionalert protocol version

Time:10-02

I have a problem with getting data from URL

weatherExists = url.exists("https://raw.githubusercontent.com/dataprofessor/data/master/weather-weka.csv")
weather <- read.csv(text = getURL("https://raw.githubusercontent.com/dataprofessor/data/master/weather-weka.csv") )

Error in function (type, msg, asError = TRUE) : error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

This URL is valid if you copy paste it into your browser the data will show so I do not get why the function is not working properly

CodePudding user response:

Just use url works.

weather <- read.csv(url("https://raw.githubusercontent.com/dataprofessor/data/master/weather-weka.csv"))

head(weather)
   outlook temperature humidity windy play
1    sunny          85       85 FALSE   no
2    sunny          80       90  TRUE   no
3 overcast          83       86 FALSE  yes
4    rainy          70       96 FALSE  yes
5    rainy          68       80 FALSE  yes
6    rainy          65       70  TRUE   no

CodePudding user response:

Use read_csv from readr

readr::read_csv('https://raw.githubusercontent.com/dataprofessor/data/master/weather-weka.csv')
# A tibble: 14 x 5
   outlook  temperature humidity windy play 
   <chr>          <dbl>    <dbl> <lgl> <chr>
 1 sunny             85       85 FALSE no   
 2 sunny             80       90 TRUE  no   
 3 overcast          83       86 FALSE yes  
 4 rainy             70       96 FALSE yes  
 5 rainy             68       80 FALSE yes  
 6 rainy             65       70 TRUE  no   
 7 overcast          64       65 TRUE  yes  
 8 sunny             72       95 FALSE no   
 9 sunny             69       70 FALSE yes  
  •  Tags:  
  • r
  • Related