Comments (4)
Not sure how to do this, given bind_rows doesn't work like other dplyr functions, wrap_dplyr_verb
won't work to naturally extend it.
from tidyjson.
bind_rows
is not an S3 method, so it is not dispatched based on class. This makes sense in one regard, because it would require "aggregating" classes across many objects.
Likely some discussion needed on what implementation is suggested for tidyjson. There is relevant discussion on this currently open issue in dplyr. The discussion is promising of S3 behavior in the future.
Not sure whether it is better to create another verb with explicit tidyjson
behavior (i.e. jbind_rows
or something), or if masking the bind_rows
function from dplyr
makes more sense. The latter has the benefit of making things nice for those who load tidyjson
after dplyr
. Of course, for those who do not, tidyjson::bind_rows
will be required.
A proposed implementation, based on the latter and drawing heavily from dplyr
. Not sure if a warning is warranted or not:
bind_rows <- function(...) {
r <- dplyr::bind_rows(...)
d <- list_or_dots(...)
if (all(unlist(lapply(d,is.tbl_json)))) {
j <- unlist(lapply(d, attr, 'JSON'), recursive=FALSE)
return(tbl_json(r,j))
} else {
warning('Some non-tbl_json objects. Reverting to dplyr::bind_rows')
return(r)
}
}
See this commit
from tidyjson.
Potential danger of implementing this before S3 support in dplyr is whether or not tidyjson
will need to reexport the bind_rows
once an S3 method is provided, for backwards compatibility.
from tidyjson.
Closed in #108 and #109 , with the caveats above.
When this lands, we should revisit: tidyverse/dplyr#2457
from tidyjson.
Related Issues (20)
- Tidyr 1.0.0 new interface HOT 1
- CRAN 0.2.4 release checklist
- Parent array dropped when child array is empty HOT 5
- Getting 'argument "json.column" is missing' error, with no explanation why, cannot find troubleshooting documentation HOT 6
- Add append_values_* documentation
- Entering object drops records
- Implement a better `bind_rows()` HOT 1
- tidyjson 0.3.0 release HOT 1
- Add compatibility with dplyr programming data masking HOT 4
- `enter_object` won't work inside function HOT 1
- `json_chr()`, `json_dbl()` and `json_lgl()` are mentioned in the README but do not exist HOT 3
- Make `spread_values(.x, ...)` work more like `dplyr::mutate(.data, ...)`
- `enter_object` : allow keeping row if object does not exist HOT 4
- Using dplyr::group_by() with tbl_json objects changes the type of `..JSON` column HOT 6
- ..JSON column without selecting it HOT 2
- how to download Worldbank dataset with an api-call HOT 2
- how to use enter_object in function ?
- updates for purrr 1.0.0 HOT 2
- CRAN Release 0.3.2
- Automatic coercion from integer to character was deprecated in purrr 1.0.0. HOT 1
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 tidyjson.