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, 2019 in Data Analytics by kavitha
508 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, 2019 in Data Analytics by anonymous
1,961 views
+1 vote
5 answers

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

Try this: df %>% filter(!is.na(col1)) READ MORE

answered Mar 26, 2019 in Data Analytics by anonymous
331,883 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
1,691 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 5, 2018 in Data Analytics by Kalgi
• 52,350 points
1,126 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,750 points
2,077 views
+1 vote
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, 2019 in Data Analytics by anonymous
• 33,030 points
5,043 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, 2019 in Data Analytics by sindhu
17,705 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, 2019 in Data Analytics by anonymous
• 33,030 points
1,145 views
+1 vote
1 answer

How to add create a box plot with categorical columns?

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

answered Jul 4, 2019 in Data Analytics by anonymous
• 33,030 points
2,049 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, 2019 in Data Analytics by anonymous
• 33,030 points
6,873 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP