check.unique: Check whether a data set identifier occurs only once for each...

Description Usage Arguments Value Examples

Description

This function will check if a identifier within a data.frame is unique. This is used, for example, to ensure that merges are performed on a one-to-one or one-to-many basis and not a many-to-many basis that might cause problems

Usage

1
  check.unique(data, id = "ppn")

Arguments

data

data frame to check

id

character string of length 1 defining the column which contains the unique identifer

Value

logical TRUE if unique, FALSE if not.

Examples

1
2
3
4
df.non <- data.frame(ppn = c(1L,1L,2L), var1 = seq_len(3))
df.unique <- data.frame(ppn = seq_len(3), var2 = seq_len(3))
check.unique(df.non, id = 'ppn')
check.unique(df.unique, id = 'ppn')

mnel/linkedEpi documentation built on May 23, 2019, 5:06 a.m.