evanodell / parlitools

A collection of useful tools for UK politics
http://docs.evanodell.com/parlitools
Other
23 stars 0 forks source link

Parlitool error: Error in open.connection(con, "rb") : HTTP error 404 #3

Open jamescPrentice opened 4 years ago

jamescPrentice commented 4 years ago

Hello.

My name is James Prentice and I am a Sussex University PhD student. I am currently studying British politics elections and have been using the parlitools package on R to create maps for sometime now and it is great. I have never had any problems with the package until today. I thought I would contact you as your name was on the package details document I found online.

Today I have got the error message of

“ Error in open.connection(con, "rb") : HTTP error 404 “

when trying to download the constituency data. Have others had this issue recently? Could it be the location of the data has moved its web address location or could this be a problem with my internet/ computer? Sadly this error message prevents my code producing the maps I have produced as the MP data can not be downloaded and the colours on the map can not be attached to them.

I have downloaded all the updates for the packages and have restarted my computer and internet connection to make sure it was nothing basic like this and the same error message is produced.

If you have any time to get back to me I would be very grateful.

evanodell commented 4 years ago

Can you put in a reprex?

On Fri, 3 Apr 2020 at 21:06, jamescPrentice notifications@github.com wrote:

Hello.

My name is James Prentice and I am a Sussex University PhD student. I am currently studying British politics elections and have been using the parlitools package on R to create maps for sometime now and it is great. I have never had any problems with the package until today. I thought I would contact you as your name was on the package details document I found online.

Today I have got the error message of

“ Error in open.connection(con, "rb") : HTTP error 404 “

when trying to download the constituency data. Have others had this issue recently? Could it be the location of the data has moved its web address location or could this be a problem with my internet/ computer? Sadly this error message prevents my code producing the maps I have produced as the MP data can not be downloaded and the colours on the map can not be attached to them.

I have downloaded all the updates for the packages and have restarted my computer and internet connection to make sure it was nothing basic like this and the same error message is produced.

If you have any time to get back to me I would be very grateful.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/evanodell/parlitools/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4M2R5YWJI76D4CMNTWETLRKY6TBANCNFSM4L4NDQNQ .

-- Evan Odell

jamescPrentice commented 4 years ago

The Code I use to start of the Map is as followed

west_hex_map <- parlitools::west_hex_map

party_col <- parlitools::party_colour

mps <- mps_on_date("2017-06-20")

mps_colours <- left_join(mps, party_col, by = "party_id") #Join to current MP data

west_hex_map <- left_join(west_hex_map, mps_colours, by = "gss_code")

I get the error message after I run the MPs on Date function. It fails to download the data for the MPs and creates the error message "Error in open.connection(con, "rb") : HTTP error 404."

Thanks for the Reply, Kind Regards, James Prentice.

evanodell commented 4 years ago

Right I’ll take a look in the morning. Is likely an issue with the api it pulls data from, the team responsible has been a bit of a mess and may not actually exist

On Fri, 3 Apr 2020 at 21:46, jamescPrentice notifications@github.com wrote:

The Code I use to start of the Map is as followed

west_hex_map <- parlitools::west_hex_map

party_col <- parlitools::party_colour

mps <- mps_on_date("2017-06-20")

mps_colours <- left_join(mps, party_col, by = "party_id") #Join to current MP data

west_hex_map <- left_join(west_hex_map, mps_colours, by = "gss_code")

I get the error message after I run the MPs on Date function. It fails to download the data for the MPs and creates the error message "Error in open.connection(con, "rb") : HTTP error 404."

Thanks for the Reply, Kind Regards, James Prentice.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/evanodell/parlitools/issues/3#issuecomment-608650217, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4M2R4MJCOH67MMGK6RFHDRKZDKTANCNFSM4L4NDQNQ .

-- Evan Odell

jamescPrentice commented 4 years ago

Thanks for the quick Reply again. The only thing I thought it could be was the location of the data where it pulls the data from may have changed but you guys know way more about this than me. Best of luck fixing the issue as the package is great and I use it often.

Kind Regards, James Prentice.

jamescPrentice commented 4 years ago

Have you had a chance to fix the issue? The same error message keeps coming up my end.

evanodell commented 4 years ago

I'm trying to reduce dependency on that particular API by storing more data within the package, as things like by-election results from 2012 are not likely to change. Should be fixed within a day or two.

jamescPrentice commented 4 years ago

Sounds like a good solution.

I have made my own solution that works ok, I just have downloaded the MPs who won in each constituency and then put it into a CSV file and then loaded into R.

`west_hex_map <- parlitools::west_hex_map

party_col <- parlitools::party_colour

mps <- read.csv("PartyID.csv") mps$party_id<-as.character(mps$party_id) is.character(mps$party_id)

mps_colours <- left_join(mps, party_col, by = "party_id")

Join to current MP data

west_hex_map <- left_join(west_hex_map, mps_colours, by = "gss_code") mps <- read.csv("PartyID.csv") west_hex_map $ party_colour <- mps $ Party_cols #fixes mps colour not working issue.