Challenge: Scalar Multiplication

Solve this challenge on scalar multiplication in R.

We'll cover the following

Exercise

The code below will plot a heatmap based on the values we write in the x matrix. Your challenge is to:

  • Create a (3×3)(3 \times 3) x matrix.
  • Assign y a scalar value of -10.
  • Multiply x and y within the plots() function in line 15 to generate the heatmap.

Use the code editor below to implement your solution.

Note: The first heatmap, in line 8, is from the original matrix before scalar multiplication was applied. You can get help by clicking “Show Solution” under the code.

Get hands-on with 1200+ tech skills courses.