Comments (8)
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.
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.
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.
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.
Merged a fix directly into master.
from cancensus.
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.
Ouch, yes, that one is on me.
from cancensus.
fixed now
from cancensus.
Related Issues (20)
- Bad dependency checks behaviour HOT 6
- Update examples and vignettes for Census 2021 data where appropriate HOT 1
- conflicting namespace HOT 2
- Translation for dataset identifiers HOT 1
- Cross tabulations
- Duplicate vector numbers HOT 2
- Unique CSD names HOT 1
- 1996's DAs calls with province region returns an empty dataframe HOT 2
- WDS endpoint HOT 1
- Original census geographies HOT 2
- Responses get_census() function are just integers divisibles by 5 or "rounded" HOT 2
- Better error message on bulk download requests
- Error when requesting empty regions in 'sf' call.
- [feature request] querying shapes directly HOT 2
- GPT 4 Cancensus HOT 1
- Some CMAs and their provincial sub-parts have the same population values HOT 2
- rgdal and rgeos dependencies HOT 3
- Error: No API key set. HOT 5
- rgdal and rgeos archived
- Broken file paths in get_statcan_geo_suite() HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cancensus.