Created
July 15, 2021 00:56
-
-
Save chelseaparlett/755c0aa66c026629101dbed324d9b3c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#---libs--------------------------------------------------- | |
library(ltm) | |
library(jsonlite) | |
library(tidyverse) | |
library(patchwork) | |
library(stargazer) | |
library(rstan) | |
library(brms) | |
library(viridis) | |
library(plotly) | |
library(DescTools) # gamma | |
library(bayesplot) | |
library(shinystan) | |
library(MASS) # polr | |
library(ordinal) # clmm | |
library(rstanarm) | |
library(beepr) | |
library(lme4) | |
library(zoib) | |
library(bayesplot) | |
library(patchwork) | |
library(qdap) #spellChecking | |
#---test code------------------------------------------------- | |
testStr <- "{\"Recall\":\"mold, steak , dread, cone, waist, tack, birch, rakem beast, spark,\\n\"}" | |
testFunc <- function(str){ | |
x <- (gsub("\\{\\\"Recall\\\":\"", "", str) %>% #get rid of beginning of dict | |
gsub("\"\\}", "", .) %>% # get rid of end of dict | |
gsub("[\r\n]", " ", .) %>% # get rid of new lines | |
gsub("\\\\n", " ", .) %>% # get rid of double newline | |
gsub("[.;]", " ", .) %>% # get rid of periods, semicolons | |
tolower( ) %>% # to lower case | |
strsplit(., "\\, |\\,| ")) #split to get each word | |
return(x) | |
} | |
testFunc(testStr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The R code works for me if I explicitly load
magrittr
withlibrary(magrittr)
. I don't think magrittr gets loaded by any of the other packages in the list in lines 1-22.