# NOT RUN {
##
## 1. Example
##
tstSNSN <- c('Raul', 'Ra`l', 'Torres,Raul', 'Torres, Ra`l',
"Robert C. \\Bobby\\\\", 'Ed \n --Vacancy', '', ' ')
# }
# NOT RUN {
<!-- % '\\' is converted to '\' before testing this in R CMD check -->
# }
# NOT RUN {
# confusion in character sets can create
# names like Names[2]
##
## 2. subNonStandardNames(vector)
##
# }
# NOT RUN {
<!-- %library(Ecdat) -->
# }
# NOT RUN {
SNS2 <- subNonStandardNames(tstSNSN)
SNS2
# check
SNS2. <- c('Raul', 'Raul', 'Torres,Raul', 'Torres, Raul',
'Robert C. "Bobby"', 'Ed', '', '')
attr(SNS2., 'secondLine') <- c(rep(NA, 5), ' --Vacancy', NA, NA)
# }
# NOT RUN {
all.equal(SNS2, SNS2.)
# }
# NOT RUN {
##
## 3. subNonStandardNames(matrix)
##
tstmat <- parseName(tstSNSN, surnameFirst=TRUE)
submat <- subNonStandardNames(tstmat)
# check
SNSmat <- parseName(SNS2., surnameFirst=TRUE)
# }
# NOT RUN {
all.equal(submat, SNSmat)
# }
# NOT RUN {
##
## 4. subNonStandardNames(data.frame)
##
tstdf <- as.data.frame(tstmat)
subdf <- subNonStandardNames(tstdf)
# check
SNSdf <- as.data.frame(SNSmat, stringsAsFactors=FALSE)
# }
# NOT RUN {
all.equal(subdf, SNSdf)
# }
# NOT RUN {
##
## 5. namesNotFound
##
noSub <- subNonStandardNames('xx_x')
# check
noSub. <- 'xx_x'
attr(noSub., 'namesNotFound') <- 'xx_x'
# }
# NOT RUN {
all.equal(noSub, noSub.)
# }
Run the code above in your browser using DataLab