Skip to content

Commit

Permalink
Updated sentence selector creation functions to remove survey stratif…
Browse files Browse the repository at this point in the history
…ication from interp mode
  • Loading branch information
kaijagahm committed Mar 11, 2021
1 parent 47672d1 commit fc09c43
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions dashboardFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,24 @@ getSentenceChoices <- function(inputList){ # function to get a list of sentence
return(a)
}

getSentenceChoicesI <- function(inputList, surveyIDString, surveySentencesTable){
# getSentenceChoicesI <- function(inputList, surveyIDString, surveySentencesTable){
# sentences <- names(inputList)
# a <- surveySentencesTable %>%
# filter(sentenceText %in% sentences,
# surveyID == surveyIDString) %>%
# select(constructionName, sentenceText) %>%
# distinct() %>%
# group_by(constructionName) %>%
# named_group_split(constructionName) %>%
# lapply(., function(x) x %>% pull(sentenceText)) %>%
# lapply(., as.list)
# return(a)
# }

getSentenceChoicesI <- function(inputList, surveySentencesTable){
sentences <- names(inputList)
a <- surveySentencesTable %>%
filter(sentenceText %in% sentences,
surveyID == surveyIDString) %>%
filter(sentenceText %in% sentences) %>%
select(constructionName, sentenceText) %>%
distinct() %>%
group_by(constructionName) %>%
Expand Down Expand Up @@ -225,16 +238,16 @@ addSentenceUI <- function(id, dat){

# addSentenceUII ----------------------------------------------------------
# Function to add the dynamic UI components for a new sentence in interpolation mode
addSentenceUII <- function(id, inputList, surveyIDString, surveySentencesTable){
addSentenceUII <- function(id, inputList, surveySentencesTable){
div(id = paste0("sentence", id, "Controls", "I"),
div(style = reduceSpacing,
selectizeInput(inputId = paste0("sentence", id, "I"),
label = paste0("Sentence ", id, ":"),
choices = getSentenceChoicesI(inputList,
surveyIDString,
#surveyIDString,
surveySentencesTable),
selected = getSentenceChoicesI(inputList,
surveyIDString,
#surveyIDString,
surveySentencesTable)[[1]][[1]],
multiple = F)),
br(),
Expand Down

0 comments on commit fc09c43

Please sign in to comment.