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

Scale is wrong for SIC #21

Closed
Robinlovelace opened this issue Apr 13, 2015 · 9 comments
Closed

Scale is wrong for SIC #21

Robinlovelace opened this issue Apr 13, 2015 · 9 comments

Comments

@Robinlovelace
Copy link
Member

The numbers on scale seem to be wrong for sic zone attributes at baseline - scale runs from -150 to 0, i.e. never positive:
selection_175

@usr110
Copy link
Member

usr110 commented Apr 13, 2015

@Robinlovelace
Have been looking at it. Might have fixed the issue. The main problem is that the zones data doesn't correspond to the recent changes you've introduced in the UI. For instance, zones data still has the old column names (like clc, plc and ecp), and not (olc, slc and sic). Please update the data. It took me a while to identify the problem.

@Robinlovelace
Copy link
Member Author

Hi Ali, have you downloaded the new data?
https://github.com/npct/pct-data

For (just uploaded) data for Cambridge, for example, I get:

zones <- readRDS(paste0(data_dir, "z.Rds"))
> head(zones@data)
   geo_code                geo_label geo_labelw avslope.x                 MSOA11NM
1 E02003790 South Cambridgeshire 016       <NA> 2.1233461 South Cambridgeshire 016
2 E02003789 South Cambridgeshire 015       <NA> 0.7129782 South Cambridgeshire 015
3 E02003783 South Cambridgeshire 009       <NA> 1.0173232 South Cambridgeshire 009
4 E02003727            Cambridge 009       <NA> 0.6278014            Cambridge 009
5 E02003779 South Cambridgeshire 005       <NA> 1.6827180 South Cambridgeshire 005
6 E02003793 South Cambridgeshire 019       <NA> 0.8454322 South Cambridgeshire 019
  percent_fem avslope.y base_olc   base_slc   base_sic gendereq_slc gendereq_sic
1    0.542705  2.123346       49   86.66586   37.66586     179.0705    130.07051
2    0.501805  0.712978      207  331.53278  124.53278     447.3453    240.34533
3    0.427505  1.017323      594  452.37003 -141.62997     551.4306    -42.56944
4    0.488830  0.627801     1680 1130.09997 -549.90003    1393.0920   -286.90797
5    0.547667  1.682718       44  178.08396  134.08396     245.3428    201.34278
6    0.414754  0.845432       38  123.92702   85.92702     199.2935    161.29347
  dutch_slc  dutch_sic ebike_slc ebike_sic av_distance cirquity   distq_f
1  353.5178  304.51777  467.4100  418.4100   14.751133 1.211822 1.0832122
2  562.4807  355.48074  680.7261  473.7261    8.623446 1.273436 1.0312778
3  652.6857   58.68569  819.6272  225.6272    5.974759 1.331313 1.0721751
4 1455.0491 -224.95093 1810.5419  130.5419    3.781013 1.334840 0.9987641
5  321.2005  277.20050  500.3245  456.3245   10.157459 1.319084 1.0118902
6  257.5082  219.50821  374.6886  336.6886   13.685469 1.279983 1.0893431

But scale bar is still 100% negative!
Please show reproducible data issue.

@usr110
Copy link
Member

usr110 commented Apr 13, 2015

I did download the recent data. Just to double check, I deleted the data folder again and also the zip file, but unfortunately the problem is still there.

manchster-zones-data

The problem is with the default data (of manchester). I've written a fix in the code for it. You may have a look at it.

@usr110
Copy link
Member

usr110 commented Apr 13, 2015

As for the scale, you might want to update the repo.

@Robinlovelace
Copy link
Member Author

Thanks Ali - confirmed it's fixed now. Regarding the data, though, please can you try the following:

url = "https://github.com/npct/pct-data/raw/master/manchester/z.Rds"
download.file(url = url, destfile = "z.Rds", method = "wget")
zones <- readRDS("z.Rds")
names(zones)

I get:

[1] "geo_code"     "geo_label"    "geo_labelw"   "MSOA11NM"     "percent_fem" 
[6] "avslope"      "base_olc"     "base_slc"     "base_sic"     "gendereq_slc"
[11] "gendereq_sic" "dutch_slc"    "dutch_sic"    "ebike_slc"    "ebike_sic"   
[16] "av_distance"  "cirquity"     "distq_f"  

Cannot reproduce your result from this repo:
https://github.com/npct/pct-data

@Robinlovelace
Copy link
Member Author

Same result with Cambridge:

url = "https://github.com/npct/pct-data/raw/master/cambridge/z.Rds"

@usr110
Copy link
Member

usr110 commented Apr 13, 2015

Thanks Robin. I get the same result, somehow. Shouldn't it work once you delete the data folder(pct-data-master) and the d.zip file from the root of the repo? That's how I used to update the data.

@Robinlovelace
Copy link
Member Author

Fixed by @usr110

@Robinlovelace
Copy link
Member Author

This should work from within the app once the old data has been deleted:

https://github.com/npct/pct-shiny/blob/master/master/master.R

# Download files - remove first if needed
if(sum(grepl("rf", list.files(data_dir))) == 0){
  url <- "https://github.com/npct/pct-data/archive/master.zip" # data store
  download(url = url, destfile = "../d.zip")
  unzip("../d.zip", exdir = "..")
}

Please confirm: are you still getting the same (wrong) result?

Robin

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