Coder Social home page Coder Social logo

Scale is wrong for SIC about pct-shiny HOT 9 CLOSED

npct avatar npct commented on July 22, 2024
Scale is wrong for SIC

from pct-shiny.

Comments (9)

usr110 avatar usr110 commented on July 22, 2024

@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.

from pct-shiny.

Robinlovelace avatar Robinlovelace commented on July 22, 2024

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.

from pct-shiny.

usr110 avatar usr110 commented on July 22, 2024

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.

from pct-shiny.

usr110 avatar usr110 commented on July 22, 2024

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

from pct-shiny.

Robinlovelace avatar Robinlovelace commented on July 22, 2024

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

from pct-shiny.

Robinlovelace avatar Robinlovelace commented on July 22, 2024

Same result with Cambridge:

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

from pct-shiny.

usr110 avatar usr110 commented on July 22, 2024

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.

from pct-shiny.

Robinlovelace avatar Robinlovelace commented on July 22, 2024

Fixed by @usr110

from pct-shiny.

Robinlovelace avatar Robinlovelace commented on July 22, 2024

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

from pct-shiny.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.