Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 208627

Merge the same dates [duplicate]

$
0
0

I have data in this format

data.frame(id = c(1,1,2), 
           date = c("2008-08-04 05:45:07","2008-08-04 09:45:07","2008-08-04 05:45:07"), 
           text = c("stg","another","final"))
#   id                date    text
# 1  1 2008-08-04 05:45:07     stg
# 2  1 2008-08-04 09:45:07 another
# 3  2 2008-08-04 05:45:07   final

How is it possible to merge the rows with the same date into one for the same id. Example of expected output:

data.frame(id = c(1,2), 
           date = c("2008-08-04", "2008-08-04"), 
           text = c("stg another","final"))
#   id       date        text
# 1  1 2008-08-04 stg another
# 2  2 2008-08-04       final

Viewing all articles
Browse latest Browse all 208627

Latest Images

Trending Articles



Latest Images