return_search_text: Return text from a freetext search

View source: R/filter_text.R

return_search_textR Documentation

Return text from a freetext search

Description

combine search terms with OR and AND then return text from a specific question

Usage

return_search_text(
  text_data,
  filter_text,
  comment_type_filter = NULL,
  search_type = c("or", "and"),
  return_dataframe = TRUE
)

Arguments

text_data

the dataframe, raw from the database

filter_text

comma separated string with search terms in

comment_type_filter

which comment to return- 1 or 2

search_type

type of search ('and', 'or')

return_dataframe

should the output be a dataframe or an html string

Value

string vector of search terms, separated by <p>, </p> for display as raw HTML by Shiny or a dataframe

Examples

return_search_text(
  text_data = data.frame(
    comment_txt = c(
      "tricky times, I recommend quick appraisals ",
      "time of my situation.", ">quick response time, competent appraisal of my situation"
    ),
    comment_type = c("comment_1", "comment_1", "comment_1")
  ),
  filter_text = "Uick, time, appraisal$, &!",
  comment_type_filter = "comment_1", search_type = "and",
  return_dataframe = FALSE
)

CDU-data-science-team/experiencesdashboard documentation built on Nov. 30, 2023, 5:57 a.m.