Description Usage Arguments Value Author(s) References Examples
Cleans MTurk Unique ID for easier merging between waves
1 | clean_turk_id(mtid)
|
mtid |
Character vector of MTurk unique identifiers |
Character vector of cleaned MTurk unique identifiers, stripping whitespace, converting case to lower, converting blanks to NA. Prints vector description.
Loren Collingwood <loren.collingwood@ucr.edu>
stringr
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.