paste_dupr: Concatenate duplicate rows

Description Usage Arguments Details Examples

View source: R/RecodeR.R

Description

This function is to concatenate duplicate rows

Usage

1
paste_dupr(id_col, concat_col, sep)

Arguments

id_col

character vector

concat_col

character vector

sep

character

Details

Note that this function also de-duplicate elements when concantenating.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#With two duplicated id; total = 29
id = c("1","2","3","4","5","5","6","7","8","9","9","10",
"11","12","13","14","15","16","17","18","19","20",
"21","22","23","24","25","26","27")
concat_col = c("4902110341812","5012427109001","8809064520019",
"7613036273800",
"9555076300000","310060143891","7613036943505","021500058506",
"078895405552","078895100020","310090143793","4898828031025",
"4901515111150","4902402534090","4899888001331","4902380188605",
"4901577042072", "4902105222843","8801043014830","4902105051306",
"4901734032083","4901085049464","4901033635053","4901033630034",
"4973344030124","4973652024501","4897020730699","4979369150106",
"8801121763933")
#Reduced to 27
paste_dupr(id, concat_col, "/")

momo3246/recode documentation built on Sept. 30, 2020, 2:14 p.m.