Merge dataframes with similar field values into one with aggregation

0 votes

For suppose if these are my dataframes, then how to make them as below. Is it possible?

#Dataframe1
col1 col2 col3
 CA  19  0.34
 TX  22  0.35
 FL  11  0.24
 OR  34  0.42
 GA  52  0.62
 MN  12  0.17
 NC  19  0.34

#dataframe2
col1 col2 col4
 FL  22  0.35
 MN  22  0.35
 CA  11  0.24
 TX  52  0.62

#final dataframe 
col1 col2 col3 col4
 CA  30  0.34  0.24
 TX  64  0.35  0.62
 FL  33  0.24  0.35
 OR  34  0.42  0.42
 GA  52  0.62  
 MN  34  0.17
 NC  19  0.34
Aug 21 in Data Analytics by kavitha
15 views

No answer to this question. Be the first to respond.

Your answer

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

Related Questions In Data Analytics

+1 vote
2 answers

Custom Function to replace missing values in a vector with the mean of values

Try this. lapply(a,function(x){ifelse(is.na(x),mean(a,na.rm = TRUE) ...READ MORE

answered Aug 14 in Data Analytics by anonymous
101 views
0 votes
4 answers

How to remove NA values with dplyr::filter()

Can we create a alist as below ...READ MORE

answered Aug 5 in Data Analytics by anonymous
9,586 views
+1 vote
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,720 points
131 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
• 42,540 points
63 views
0 votes
1 answer

How to replace NA values in a dataframe with Zero's ?

It is simple and easy: df1<-as.data.frame(matrix(sample(c(NA, 1:10), 100, ...READ MORE

answered Apr 10, 2018 in Data Analytics by CodingByHeart77
• 3,690 points
152 views
0 votes
2 answers

How to count the number of elements with the values in a vector?

Use dplyr function group_by(). > n = as.data.frame(num) > ...READ MORE

answered Aug 21 in Data Analytics by anonymous
• 31,840 points
131 views
0 votes
3 answers

Code snippet to find number of null values in each column in a dataframe in R

colSums(is.na(data_frame_name)) will return you number of nulls ...READ MORE

answered Jul 5 in Data Analytics by sindhu
189 views
0 votes
1 answer

% of nulls for each column in the dataset - R

Use code as below -  lapply(air,function(x) { length(which(is. ...READ MORE

answered Jul 4 in Data Analytics by anonymous
• 31,840 points
37 views
0 votes
1 answer

How to add create a box plot with categorical columns?

One way is to convert to factor ...READ MORE

answered Jul 4 in Data Analytics by anonymous
• 31,840 points
64 views
0 votes
1 answer

Convert data.frame object into character vector/list

Hi, it is possible to store them ...READ MORE

answered Jul 9 in Data Analytics by anonymous
• 31,840 points
45 views