clean_turk_id: Clean MTurk ID

Description Usage Arguments Value Author(s) References Examples

Description

Cleans MTurk Unique ID for easier merging between waves

Usage

1

Arguments

mtid

Character vector of MTurk unique identifiers

Value

Character vector of cleaned MTurk unique identifiers, stripping whitespace, converting case to lower, converting blanks to NA. Prints vector description.

Author(s)

Loren Collingwood <[email protected]>

References

stringr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# GENERATE RANDOM IDS #
letter_rand <- function(n=100) {
  a <- do.call(paste0, replicate(4, sample(LETTERS, n, TRUE), FALSE))
  paste0(a, sprintf("%04d", sample(9999, n, TRUE)), sample(LETTERS, n, TRUE))
}
  
# EXECUTE FUNCTION #
mtid_toy_vec <- letter_rand()

# MANIPULATE A FEW FOR PEDAGOGICAL PURPOSES (DID I SPELL THAT REAL GOOD?)
mtid_toy_vec[100] <- paste("", mtid_toy_vec[100], " ")
mtid_toy_vec[99] <- ""
mtid_toy_vec[98] <- paste("28n0", mtid_toy_vec[98], sep="_")

#EXECUTE FUNCTION #
mtid_r <- clean_turk_id(mtid_toy_vec)
head(mtid_r)

lorenc5/Rmturkcheck documentation built on June 5, 2019, 10:59 a.m.