(Called 'Manipulate Variables' in iNZight Lite
Convert variables to new types, create new variables, and rename existing ones)
iNZight assumes that data sets are in rows = cases by columns = variables format. For example, the cases (also often called units) may be individual people and the columns = variables contain different types of "measures" on those people.
By default, if all the values of a variable are numbers, then that variable will be treated as as a numeric variable.
If any of the values contains even one alphabetic character, then (by default) the whole variable will be treated as a categorical variable (i.e., one that gives group membership). The one exception is the value NA
, which is treated as a missing-value code in both numeric and categorical variables.
Creates a categorical version of a numeric variable (for more sophisticated version see ...Convert to Categorical (Multiple) ...).
By default, the levels of a categorical variable are displayed in alpha-numeric order. This enables you to change from the default order of display to something more natural; e.g. from {"adolescent", "adult", "child", "elder"} to {"child", "adolescent", "adult", "elder"}.
Combine levels within a categorical parent variable to make a new variable with a smaller number of levels. (The levels of a categorical variable are the set of unique, or distinct, values it takes).
Change the names of the levels of a categorical variable, e.g. from (ages) {"< 12", "12-17", "18-69", "> 69"} to {"child", "adolescent", "adult", "elder"}.
Take two categorical variables and create a new categorical variable whose levels are all combinations of those two (e.g., the combinations of ethnicity and gender).
Creates a new variable that is a transformed version of the parent variable. Transformations available are log
(base e
or base 10), exponential, square, square root and reciprocal.
Create a standardised version of a variable (or z-score) by subtracting the mean of the variable from each value and dividing by its standard deviation.
Create a categorical variable whose levels are class intervals of a numeric variable.
For example, take age
and create age.f
with levels {"{0,20]", "(20,60]", "(60,110]"}.
Creates a new numeric variable containing the rank, or order of the selected variable. This is often used when the order of the values (but not the values themselves) is of interest.
For example, the variable age = {15, 12, 19, 16}
would result in the new variable age.rank = {2, 1, 4, 3}
.
This has the same result as the previous "Convert to Categorical" tool, however it allows users to convert multiple variables at once.
Convert a variable to a standard dates and times (POSIXct) format and saves as a new variable.
In the example that follows, Time.stamp is a categorical variable that we wish to convert to a variable that iNZight recognises as a datetime variable.
Creates a new variable by extracting specific component (e.g. data, year, time...) from a dates and times variable in a large variety of levels of detail and of format.
In the example that follows, Time.stamp.dt is a categorical variable that we wish to convert to a variable that iNZight recognises as a datetime variable Timestamp.dt. What we want to do is extract a new variable containing the Year and the decimal part of the Year ("Decimal Year")
Converts to
and aggregates using sum, mean, or median.
In the Example, origintime
is a date-time variable [thus, annotated (t)
in View Variables] and we have chosen to convert it to monthly (yyyy Myy
) with all of the values in the same month aggregated to their mean
.
The count
column shows how many values have been aggregated. If there are missing values present in a variable being aggregated, then another column of the form variable.missing
. Missing values are ignored when aggregating.
In the Example below a categorical variable in monthly (yyyy Mzz
) format is aggregated to quarterly (yyyy Qz
).
Rename variables in the dataset. Especially useful for variables created by iNZight.
A very flexible facility for creating new variables from existing variables, essentially by doing arithmetic on them.
Left-hand box: desired name for new variable
Right-hand box: any valid R expression
Examples
income = hours * payrate
weight.diff = end.weight - begin.weight
average.weight = ( begin.weight + endweight) / 2
Categorical variables:
Any missing observations for the variable we be given a new level, missing
. All others remain the same.
missing
and observed
.Delete variables from the dataset. Click variable names using the Shift and Control keys to choose multiple variables for deletion.