Comments (5)
In essence, what I wanted to achieve was a wrapper for merge(x1, x2, all = TRUE)
but it seems like merge_df()
is doing something a little different:
x1 <- efc %>% dplyr::select(1:5) %>% slice(1:10)
x2 <- efc %>% dplyr::select(3:7) %>% slice(1:10)
merge(x1, x2, all = TRUE) %>% dim()
# [1] 10 7
merge_df(x1, x2) %>% dim()
# [1] 20 7
from sjmisc.
Ok, this was a wrong description in the docs of merge_df()
. I think I had an example where base merge()
did the same as merge_df()
, but maybe I was wrong or using a very specific example, which yielded the same results in both merge()
and merge_df()
.
merge_df()
intends to "append" two data frames, thus it is an additional feature to dplyr's join_*()
functions. So, it's working as intended, just the description with merge() was wrong. I fixed the docs.
from sjmisc.
btw, dplyr's join-function preserve all label attributes, so you can use these if you need other join-operations.
from sjmisc.
Thanks for the clarifications! Yes I used dplyr::left_join()
to much avail.
from sjmisc.
A typical use case is for example, if you have different country data sets that share a common amount of variables, plus some country specific variables for each country. You can then "merge" these data sets, i.e. all are "row bound", while the specific variables that only appear in one of the data sets is also added as new column, with NA values for those subsets that don't have this variable.
from sjmisc.
Related Issues (20)
- sjmisc::rec() behaviour with mutate() and value ranges
- Bugs of frq related to sj-labelled character factors and tagged NA's, and minus select helpers HOT 5
- Rec bug with "lo" characters
- select_helpers not working HOT 1
- Important bug in Rec HOT 2
- the speed of "rec" function slow when I use mutate with large dataset
- `move_columns` does not work when passed a variable in .after HOT 1
- rec and space strings
- Frequency of characters coercible as numerics
- Use str_contains for dataframe? HOT 2
- merge_imputations only providing a subset of variables
- Merges multiple imputed data frames into a single data frame HOT 3
- row_means() proportion of datapoints HOT 2
- FR: allow more printing formatting for frq HOT 1
- weights argument fails when using dplyr group_by
- frq fails when used for more than 1 variable and after `dplyr::group_by`
- Does not merge when data are in long format HOT 1
- Feature request: use -c syntax for descr "show" argument
- Issue with weighted percentage in `flat_table()`
- Issue with rec() else=copy not passing old labels
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 sjmisc.