r - cbind different length of data frames based on column -


i have 2 dataframes:

df1 name stock_1 stock_2      11      12 b       9       2 c       1       3  df2 name stock_1 d     2 e     4 

expected output:

 name stock_1 stock_2          11      12     b       9       2     c       1       3     d     2        na     e     4        na 

the name , stock_1 names of columns. try cbind 2 df not working. there efficient way?

we use dplyr::full_join() :

library(dplyr) df3 <- full_join(df1, df2) df3   name stock_1 stock_2 1         11      12 2    b       9       2 3    c       1       3 4    d       2      na 5    e       4      na 

Comments

Popular posts from this blog

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

laravel - Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id (View: F:\project\resources\views\admin\carousels\index.blade.php) -