Calculating numeric variables
This article is part of The Definitive Guide to Uploading and Preparing Data.
You may need to calculate numeric variable to do any number of tasks, for example you may want to:
- Calculate respondents' age from the date of birth
- Sum or average numeric variables
- Calculating the difference between two variables
- Any other calculations you can think of involving numerics
In the web app
- Not available
Crunch Automation
Using R
- You simply write the expression and store it as a new variable
Examples:
ds$sum <- var1 + var2 + var3
ds$average <- (var1 + var2 + var3) /3
ds$difference <- var2 - var1