remove.duplicated.ids: Remove duplicated ids

Description Usage Arguments Details Value Examples

View source: R/common.R

Description

Remove duplicated ids

Usage

1
remove.duplicated.ids(result, idcol = colnames(result)[1])

Arguments

result

data.frame of scoring results.

idcol

the name of the column that contains person id's. If none given, the first column of result is used.

Details

Duplicated persons are combined into one.

Scores on all variables are set to the max score given to this person on this variable. If there are only NA's on a variable, NA is retained. Non-numeric variables are given the value of the first occurrence of the person.

Value

Returns a data.frame with duplicated persons unified.

Examples

1
2
result<-data.frame(id=c("b","b","a","a","c","d","a"),X1_result=c(1,NA,2,2,1,3,NA),X2_party=c(2,1,3,1,2,3,NA),X20_dont=c(NA,2,1,2,1,3,NA),sex=c("Male","Female","Male","Female","Female","Male","Female"))
remove.duplicated.ids(result)

openPCI/OpenPCIScoring documentation built on June 10, 2021, 1:18 p.m.