Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Matrix Row Means | Apply Family Functions in R
Control Flow in R

bookChallenge: Matrix Row Means

Task

Swipe to start coding

You are given three different data objects: a matrix of student scores, a list of monthly sales for stores, and a vector of product prices.

  • Use the apply function to find the highest score for each student (each row in the matrix).
  • Use the lapply function to calculate the total sales for each store in the sales_list.
  • Use the sapply function to round each price in prices to the nearest integer, and store the result in a variable called rounded_prices.

Store your results in variables named:

  • student_highest_scores for the highest scores per student;
  • store_total_sales for the total sales per store;
  • rounded_prices for the rounded product prices.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 2
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: Matrix Row Means

Swipe to show menu

Task

Swipe to start coding

You are given three different data objects: a matrix of student scores, a list of monthly sales for stores, and a vector of product prices.

  • Use the apply function to find the highest score for each student (each row in the matrix).
  • Use the lapply function to calculate the total sales for each store in the sales_list.
  • Use the sapply function to round each price in prices to the nearest integer, and store the result in a variable called rounded_prices.

Store your results in variables named:

  • student_highest_scores for the highest scores per student;
  • store_total_sales for the total sales per store;
  • rounded_prices for the rounded product prices.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 2
single

single

some-alt