Introduction
The “Can ‘You Draw It’?” app is an interactive Shiny web application
that allows users to draw lines on a data plot, enabling visual
estimation and modeling of data trends. This shiny app utilizes and
accompanies the youdrawitR
package.
Features
Main Interface
The main interface consists of a plot that users can interactively draw lines on. The interface also includes several buttons and options, such as:
-
Change Data: Change the data source for plotting and analysis. Press on the button to access the dropdown menu with following options:
Input Data: Upload your data via file upload or text box. A pop-up for options will display once the user presses the link.
Simulate Data: Create simulated data. A pop-up for options will display once the user presses the link.
Use R Data set: Choose from pre-loaded R data sets to plot and analyze. A pop-up will display once the user presses the link with data set options. Users can choose x and y variables by pressing on the columns of the data set. (hover over data table to see tooltip for further instruction)
Reset: Clear all user-drawn lines and reset the progress.
Generate New Random Data (button with dice icon): Generates new random linear data.
Add New Line/Stop Drawing Button: Clicking this button initiates the drawing of a new line, turning the button red. Clicking it again, now labeled “Stop Drawing”, concludes the new line and reverts back to extending the original line. Users cannot edit a line once concluded.
Show/Hide Tooltip Check box: Toggles the visibility of the tooltip.
Confidence Interval Check box: Toggles the generation of the confidence intervals.
Change color Check box: Enables users to change colors for different parts of the app, including the progress region color, drawn line color, and regression line & confidence interval color (which display upon completion of drawn line). A drop-down menu and color palette appear upon checking this box.
Recorded Data
Once the user has completed the graph (indicated by the progress region), the recorded x and y data of the user lines will be shown. You can select which data you want to display: the original line or new user-drawn lines, if it exists. If multiple new user-drawn lines were drawn you can also select the line data you would like to display using the slider input, which is by precedence of when the line was drawn (so the first new user-drawn line will be number 1 etc). The user can then save this data to their local device using the Download Data button (shown as a download icon). Clicking this button will download the data that the user is currently viewing. To easily process the downloaded data in R use this code:
read.csv("path to file")
Alternatively, if the user would prefer not to save the data to their local device they can also copy the data to clipboard by pressing the Copy Data button (shown as a clipboard icon). Doing this will copy the data to the user’s clipboard. To easily process the copied data in R use this code:
read.csv(text = "copied data")
Additionally, if the user is running the shiny app in their own R session, instead of using the published version, pressing the Copy Data button will automatically assign the variable to “copied_data” in their global environment for future use.
With the data in R, you can perform further analysis, visualization, or any other data manipulation tasks according to your requirements.
How To Use
Toggle the display of the tooltip and confidence intervals with the respective checkboxes.
Customize the color of various components using the “Change color” checkbox. Select the component you want to change and pick a color from the palette.
Optionally, change the data source by clicking “Change Data” and selecting one of the available options: “Input Data,” “Simulate Data,” or “Use R Dataset.” Depending on your choice, you’ll be guided through the process of loading or generating data.
Draw a line by clicking and dragging your mouse across the plot. To add a new line line, click the “Add New Line” button. This will be the current drawing line until you click stop drawing (then the current drawing line will go back to original line). Clicking again will add a new line. Users cannot go back to a newly drawn line once they stop drawing. Changing the color of the drawn line will only change the original and all new added lines, any previously added drawn lines will remain their original color.
Choose your drawn line data by selecting “Original line” or New lines” in the “Select data to display” section. Use the slider to select the line you want to display.
Save the recorded data for later use by clicking the download data or copy data buttons.
Click Reset to clear all user-drawn lines and reset the application.
To run shiny app in R the user can copy this code:
shiny::runApp(system.file("shinyapp/youdrawit", package = "youdrawitR"))
You can also access the app directly through your web browser by following this link.