13.1 Data

I started by setting initial values using reactiveValues() to store user input.

First the google input store with 4 values values$google_search <- c("Amazon", "Walmart", "Best Buy", "Target"), time with values$time <- "today 12-m" and the product with values$product <- "web". Why don’t I want to save entries after the user clicks the submit button? The idea is that when you start the app, the app loads all charts and tables without hitting the submit button. Then, as users enter different inputs, reactiveValues() updates the inputs.

For date entry, there were two options to get user entry. Since the user selects Specify or Date, ifelse() must be used to return the Date.

Now that we have all the user inputs, we can start processing the data. gtrends() provides the query output

  1. interest_over_time
  2. interest_by_city
  3. interest_by_dma
  4. related_queries
  5. related_topics

The following code shows how to apply gtrends() to return a list of data used for this application. In this case, the R code dataout() below is a list of the data to use interest_over_time, interest_by_region, interest_by_dma, related_queries