Error in open.connection(con, "rb") :

> ext_tracks_file <- paste0("http://rammb.cira.colostate.edu/research/",
+                           "tropical_cyclones/tc_extended_best_track_dataset/",
+                           "data/ebtrk_atlc_1988_2015.txt")
> library(readr)
> 
> # Create a vector of the width of each column
> ext_tracks_widths <- c(7, 10, 2, 2, 3, 5, 5, 6, 4, 5, 4, 4, 5, 3, 4, 3, 3, 3,
+                        4, 3, 3, 3, 4, 3, 3, 3, 2, 6, 1)
> 
> # Create a vector of column names, based on the online documentation for this data
> ext_tracks_colnames <- c("storm_id", "storm_name", "month", "day",
+                          "hour", "year", "latitude", "longitude",
+                          "max_wind", "min_pressure", "rad_max_wind",
+                          "eye_diameter", "pressure_1", "pressure_2",
+                          paste("radius_34", c("ne", "se", "sw", "nw"), sep = "_"),
+                          paste("radius_50", c("ne", "se", "sw", "nw"), sep = "_"),
+                          paste("radius_64", c("ne", "se", "sw", "nw"), sep = "_"),
+                          "storm_type", "distance_to_land", "final")
> 
> # Read the file in from its url
> ext_tracks <- read_fwf(ext_tracks_file, 
+                        fwf_widths(ext_tracks_widths, ext_tracks_colnames),
+                        na = "-99")
Error in open.connection(con, "rb") : 
  Failed to connect to rammb.cira.colostate.edu port 80: Connection refused

I am getting above error. Please guide.

Hi,
Thanks for your reproducible example. It turns out your code works on my computer.
This thread on SO might help you: https://stackoverflow.com/questions/37794368/error-in-open-connectionx-rb-couldnt-connect-to-server .

3 Likes

The code works for me too and looks fine.

Sometimes security and permissions settings can cause issues. Are you on a work computer/environment?

Yes, I am on work computer. However, though if I get to know actually which security and permissions are affecting I can get exception for those. Currently, I can access this URL directly. The issue is accessing within R only.