Tables - Raw Data - Variables
Creates a table of raw data values, as they appear when the data is analyzed in R (e.g., showing factors for categorical variables).
How to Create a Raw Data Table
- Add the object:
- In Displayr: Table > Raw Data > Variable(s)
- In Q: Create > Tables > Raw Data > Variables
- Select the variables to appear in the rows using Inputs > Variables.
Example
The table below uses Respondent type, Research ID and Global frequentCola as the columns of the table.
Options
The options in the Object Inspector are organized into two tabs: Inputs and Properties.
Inputs
Variables The variables to appear in the rows, as categories.
Variable names Displays Variable Names in the output.
Filter The data is automatically filtered using any filters prior to estimating the model.
Properties
This tab contains options for formatting the size of the object, as well as the underlying R code used to create the visualization, and the JavaScript code use to customize the Object Inspector itself (see Object Inspector for more details about these options). Additional options are available by editing the code.
More Information
How to Check Respondent-level Data in Displayr
Code
var displayr = Q.isOnTheWeb();
var variables_prompt = displayr ? "Variables are found in Data Sources (bottom-left)" :
"Variables are shown in the 'Variables and Questions' tab.";
var heading_text = 'Raw Data';
if (!!form.setObjectInspectorTitle)
form.setObjectInspectorTitle(heading_text, heading_text);
else
form.setHeading(heading_text);
form.dropBox({label: "Variables",
types:["Variable: Numeric, Date, Money, Categorical, OrderedCategorical, Text"],
name: "formVariables",
multi:true, prompt: variables_prompt})
form.checkBox({label: "Variable names", name: "formNames", default_value: false, prompt: "Display names instead of labels"})
library(flipFormat)
library(flipTransformations)
if (length(unique(sapply(formVariables, length))) != 1)
stop("All variables must be the same length and are not.")
rawdata = ProcessQVariables(data.frame(if (length(formVariables) == 1) formVariables[[1]] else formVariables, stringsAsFactors = FALSE))
rawdata = rawdata[QFilter,, drop = FALSE]
names(rawdata) <- if(!formNames) lapply(formVariables, Labels) else lapply(formVariables, Names)
if (nrow(rawdata) * ncol(rawdata) > 1000000)
stop("Your table contains more than 1,000,000 cells. To get around this limitation, edit the R Code, or, create tables using RAW DATA.")
raw.data <- rawdata