1. Learn
  2. /
  3. Courses
  4. /
  5. Helsinki Open Data Science

Connected

Exercise

Scaling variables

The next step is wrangling the data into a format that is easy to analyze. We will wrangle our data for the next few exercises.

A neat thing about R is that may operations are vectorized. It means that a single operation can affect all elements of a vector. This is often convenient.

The column Attitude in lrn14 is a sum of 10 questions related to students attitude towards statistics, each measured on the Likert scale (1-5). Here we'll scale the combination variable back to the 1-5 scale.

Instructions

100 XP
  • Execute the example codes to see how vectorized division works
  • Use vector division to create a new column attitude in the lrn14 data frame, where each observation of Attitude is scaled back to the original scale of the questions, by dividing it with the number of questions.