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

Answer by lmo for merging data into existing column

$
0
0

This produces the output you want, though it is a two-step process.

# get data with some nice namesnews <- data.frame(date=c("2016-05-20","2016-05-19","2016-05-19"), lets=c("x","y","z"))data <- data.frame(date=c("2016-05-20","2016-05-21","2016-05-22"), nums=c(1,2,3))# combine observations with the same datenewsC <- aggregate(lets~date, data=news, FUN=paste, collapse="&&")merge(data, newsC, by="date", all=TRUE)

The first error you are getting is because you are not specifying a second data.frame in merge.


Viewing all articles
Browse latest Browse all 3

Trending Articles



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