Comments (6)
Shoot! I will take a look at this, thanks for letting me know.
from safegraphr.
Figured it out - this is due to now the na.rm
option works. It only removes missing values for variables specified in expand_int
or expand_cat
. It doesn't drop missings for distance_from_home
, then, so sum()
returns an NA
if there are any missing values.
I will try to get a fix for this. In the meantime, you can get around this by specifying an aggregation function that handles NA
s. So fun = function(x) sum(x, na.rm = TRUE)
in your read_patterns()
call should handle it.
from safegraphr.
Thanks Nick! Appreciate any help you can offer with this, will give that a try.
from safegraphr.
I gave that a try and received this error:
Attempted to find start_date from filename. I think it's YYYY-MM-DD 2020-03-02
Error in `[.data.table`(patternsb, , lapply(.SD, fun), by = by) :
Column 4 of result for group 2 is type 'double' but expecting type 'integer'. Column types must be consistent for each group.
Any idea on what the problem could be? Thanks!
from safegraphr.
Hmm, two possibilities come to mind - the first is that you've left some columns in there that sum()
doesn't accept (try the select()
option to get rid of them). Another is that, within states, sum()
produces a double in one group but not another for some reason.
Two approaches to fixing:
- Try `fun = function(x) sum(as.double(x), na.rm = TRUE)
- The benefits of
read_patterns
really show up when you're using one of theexpand
options. Since you're not, you might want to just usefread
to read the file directly, usefips_from_cbg()
to extract the state and county FIPs values (see the help file for examples), and then aggregate it yourself, which will give you more control.
from safegraphr.
Should be fixed by 2bc66ad
from safegraphr.
Related Issues (11)
- Link to your package down website
- Read_many_patterns ERROR
- Number of files (0) does not match number of start_dates (1) to go along with them
- cbg_pop issue with poi_cbg codes?
- Turn on GitHub Pages HOT 1
- Install error
- Feature request: expand open hours HOT 2
- Error: read_distancing() fails to detect files HOT 1
- What version of R does SafeGraphR work with? HOT 1
- initial_rowno in expand_cat_json() is wrong if by=F, JSON empty, and na.rm = T
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 safegraphr.