Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jamescPrentice opened this issue Apr 3, 2020 · 7 comments

Comments

@jamescPrentice
Copy link

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
Copy link
Owner

evanodell commented Apr 3, 2020 via email

@jamescPrentice
Copy link
Author

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
Copy link
Owner

evanodell commented Apr 3, 2020 via email

@jamescPrentice
Copy link
Author

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
Copy link
Author

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

@evanodell
Copy link
Owner

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants