Quantcast
Channel: merging data into existing column - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by RoyalTS for merging data into existing column

$
0
0

A plyr/dplyr-based solution:

library(dplyr)news <- data.frame(date=c("2016-05-20","2016-05-19","2016-05-19"),                   letters=c("x","y","z"), stringsAsFactors = FALSE)data <- data.frame(date=c("2016-05-20","2016-05-21","2016-05-22"),                   numbers=c(1,2,3), stringsAsFactors = FALSE)df <- plyr::rbind.fill(news,data)df.combined <- df %>% group_by(date) %>% summarize_each(funs(paste(na.omit(.), collapse="&& ")), letters:numbers)

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>