Binding rows of 2 data-frames which have non-identical columns

0 votes

Let's say i have these 2 data-frames:

abc
  name   salary age
1  raj 12345.55  36
xyz
  fruit cost quantity
1 apple  123       10

Now, if i use rbind, i get this error:

 rbind(abc,xyz)
Error in match.names(clabs, names(xi)) : 
  names do not match previous names

So, is there a way to bind the rows of these 2 columns/ 

May 21, 2018 in Data Analytics by BHARANI
• 400 points
103 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can use the smartbind() function from 'gtools' package:

>library(gtools)
> smartbind(abc,xyz)
  name   salary age fruit cost quantity
1  raj 12345.55  36  <NA>   NA       NA
2 <NA>       NA  NA apple  123       10
answered May 21, 2018 by Bharani
• 4,550 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

How can I use parallel so that it preserves the list of data frames

You can use pmap as follows: nc <- ...READ MORE

answered Apr 4, 2018 in Data Analytics by kappa3010
• 2,010 points
18 views
0 votes
1 answer

Join list of data.frames using map() call

You can use Reduce set.seed(24) r1 <- map(c(5, 10, 15), ...READ MORE

answered Apr 5, 2018 in Data Analytics by darklord
• 6,140 points
8 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,700 points
32 views
0 votes
1 answer

How to convert a list of vectors with various length into a Data.Frame?

We can easily use this command as.data.frame(lapply(d1, "length< ...READ MORE

answered Apr 4, 2018 in Data Analytics by DeepCoder786
• 1,700 points
31 views
0 votes
2 answers

In data frame how to spilt strings into values?

You can do this using dplyr and ...READ MORE

answered Dec 4, 2018 in Data Analytics by Kalgi
• 35,720 points
21 views
0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer

Finding number of missing values and removing those missing values from a data-frame

This code gives the total number of ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,550 points
19 views
0 votes
1 answer

Building Random Forest on a data-set comprising of missing(NA) values

You have two options, either impute the ...READ MORE

answered Apr 2, 2018 in Data Analytics by Bharani
• 4,550 points
75 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.