5 LexOPS Shiny App

The Shiny app is an interactive user interface for LexOPS, with informative visualisations and illustrations of selected options. The LexOPS Shiny app can be run locally with:

LexOPS::run_shiny()

A demo of the Shiny app is available online at https://jackt.shinyapps.io/lexops/, but running the app locally is highly recommended for reliability and speed.

5.1 Generate

The Generate tab is a user interface for the “generate pipeline”. This allows you to generate stimuli for any possible factorial design.

5.1.1 Specify Design

Splits (independent variables), controls, and filters can be specified in the following way:

  1. Click the ‘+’ button to add a new variable.
  2. Choose a variable from the drop-down menu.
  3. Select a source for the variable if necessary (i.e. “according to…”).
  4. Specify the boundaries or tolerances
Specifying a design in the shiny app.

Figure 5.1: Specifying a design in the shiny app.

5.1.2 Options

Here you can tell the app how many stimuli should be generated per condition, which condition should be used as the match null, and which variables to include in the long-format version of the results.

Options for the Generate tab.

Figure 1.1: Options for the Generate tab.

5.1.3 Results

This is where you can see the generated stimuli. A different set of stimuli which fit the design will be generated each time the “Regenerate” button is clicked. You can switch between viewing the stimuli in wide or long format, and can download the stimuli in either format as a file: generated_stimuli.csv.

Generating stimuli and viewing the results.

Figure 5.2: Generating stimuli and viewing the results.

5.1.4 Review

Once the stimuli have been generated, this section allows you to view a summary of the generated stimuli. You can view how splits, controls, and filters differ between conditions and across matched items (which calls the plot_design() function). You can also view the cumulative item generation (from the plot_iterations() function), and check the distribution of the match nulls.

Reviewing generated stimuli.

Figure 5.3: Reviewing generated stimuli.

5.1.5 Codify

This is a handy feature that lets you translate the selected options into LexOPS R code to reproduce the design. To reproduce a specific stimulus list, set the seed in the Preferences tab.

Translate selected options into LexOPS R code.

Figure 5.4: Translate selected options into LexOPS R code.

5.2 Match Item

The Match Item tab is a user interface for the match_item() function. As in the Generate tab, you can specify variables that should be matched by (with tolerances relative to the target string) and filtered by (with boundaries independent of the target string). You can then view and download the suggested matches.

Matching individual words in the Match tab.

Figure 5.5: Matching individual words in the Match tab.

5.3 Fetch

The Fetch tab is an easy way to get values from the LexOPS database (or uploaded in the Custom Variables tab) for your own list of words. As an example, I may have a file, my_stimuli.csv, with the following contents:

word likert_rating mean_RT
pigeon 1.40 456.0
dog 5.20 423.5
wren 6.00 511.0
symbiosis 4.44 503.2
shark 4.20 482.3

I could then upload this to the Fetch tab. This will return the known values from the LexOPS dataset for my list of stimuli:

Fetching the features of a stimulus list.

Figure 5.6: Fetching the features of a stimulus list.

5.4 Visualise

The Visualise tab provides many options for plotting useful information. As well as the variables included in the LexOPS dataset and custom variables, the Visualise tab can plot information from within the app, such as the generated condition.

Here’s an example application of the visualise tab to look at stimuli generated in the Generate tab (in a Bigram Probability x Concreteness design). Points can be coloured by things like generated condition, and individual words can be identified by hovering over the points.

Example usage of the Visualise tab.

Figure 2.1: Example usage of the Visualise tab.

5.5 Custom Variables

The Custom Variables tab is useful for integrating variables not in the LexOPS dataset to the app. Importantly, the words which have custom variables can be in any language. These variables can then be used within the app for generating stimuli. Custom variables are only available for the current session.

Here is an example in which the variables from the Leipzig Affective Norms for German (LANG) (Kanske & Kotz, 2010) are added to the LexOPS shiny app. These variables can then be used in the Generate tab.

Using stimuli for languages other than English.

Figure 2.2: Using stimuli for languages other than English.

The Custom Variables tab uses dplyr’s join functions. An equivalent to using custom variables in R code would be to either join the custom variables to the LexOPS dataset using dplyr’s join functions, or to just run the generate pipeline on a dataframe of custom variables (see this section for an example).

5.6 Random Seeds

The seed can be set in the Preferences tab to reproduce specific lists of generated stimuli. This means that the exact same list of words will be generated each time you click “Regenerate”.

Setting the seed in the Shiny app.

Figure 5.7: Setting the seed in the Shiny app.

If you “codify” your selected options, the generated code will also set the seed as the same value, such that a stimulus list can be reproduced outside of the shiny app.

Note that in order to reproduce stimulus lists generated with R code within the shiny app, the seed should be set using the seed argument of the generate() and split_random() functions. See this section on random seeds in the generate pipeline for some examples.