Giter Site home page Giter Site logo

Comments (8)

mountainMath avatar mountainMath commented on August 24, 2024

Getting the same error from this (in the second line):

d <- get_census("CA16",regions=list(CSD="5915022"), vectors = "v_CA16_2397", geo_format = 'sf', labels="short") 
d %>% rename(median_hh_inc=v_CA16_2397)

However, if I replace the second line with

d %>% select(v_CA16_2397) %>% rename(median_hh_inc=v_CA16_2397)

it works.

from cancensus.

dshkol avatar dshkol commented on August 24, 2024

Was this code that worked before or brand new code? If it worked before, then I suspect it's a tidyselect issue. I've been pretty unhappy to the NSE variable selection syntax since the recent dplyr updates - where it now relies on the tidyselect API on the backend.

from cancensus.

mountainMath avatar mountainMath commented on August 24, 2024

Yes, this worked before. Just confirmed by re-running my last blog post. Breaks now. Also, this seems to be an 'sf' issue. Code runs through just fine if no geographies are requested:

get_census("CA16",regions=list(CSD="5915022"), vectors = c("med_hh_inc"="v_CA16_2397")) 

Do you still have older sf or the newest one? Does it work for you?

from cancensus.

mountainMath avatar mountainMath commented on August 24, 2024

Ok, I think I found the problem. Somehow this issue is caused by the line in our code that renames vectors to 'short' form. if we replace that line with

else {result <- rename(result,!!!setNames(names(.),gsub(":.*","",names(.))))}

Everything works out. Somehow assigning

names(result)=gsub(":.*","",names(result))

breaks something for sf objects.

from cancensus.

mountainMath avatar mountainMath commented on August 24, 2024

Merged a fix directly into master.

from cancensus.

dshkol avatar dshkol commented on August 24, 2024

This introduces new errors - as seen by the CI errors.

For starters

rename(result,!!!setNames(names(.),gsub(":.*","",names(.))))}

should be

dplyr::rename(result,!!!setNames(names(.),gsub(":.*","",names(.))))}

but then that still causes the other error.

I was using sf 0.9-3 - updating now.

In the future let's not commit changes like that to master. The error likely didnt come up for you locally because of caching. It didn't for me either with this commit until I forced refresh of data.

from cancensus.

mountainMath avatar mountainMath commented on August 24, 2024

Ouch, yes, that one is on me.

from cancensus.

dshkol avatar dshkol commented on August 24, 2024

fixed now

from cancensus.

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.