Contenido del Curso
R Introduction: Part II
R Introduction: Part II
Sales and Revenue
Let's consolidate acquired knowledge with a practical task!
Note
If you want to multiply each element of the row to a specific value (i.e., not one number for all elements), you need to have the condition: the number of rows of the matrix equals the multiplying vector length satisfied.
Swipe to show code editor
You have the selling data for a local furniture store stored in the sellings
matrix.
Month | Sofa | Armchair | Dining table | Dining chair | Bookshelf |
---|---|---|---|---|---|
March | 16 | 21 | 30 | 23 | 10 |
April | 40 | 39 | 13 | 21 | 16 |
May | 11 | 21 | 36 | 32 | 16 |
And vector of prices named prices
.
Sofa | Armchair | Dining table | Dining chair | Bookshelf |
---|---|---|---|---|
340 | 150 | 115 | 45 | 160 |
Your tasks are:
- Output the total number of items sold each month.
- Transpose of the
sellings
matrix and reassign the result to thesellings
variable. - Find out revenue by each good by multiplying
sellings
andprices
. Save the result to theincome
variable. - Output the monthly revenues.
- Output the total three months' revenue.
¡Gracias por tus comentarios!
Sales and Revenue
Let's consolidate acquired knowledge with a practical task!
Note
If you want to multiply each element of the row to a specific value (i.e., not one number for all elements), you need to have the condition: the number of rows of the matrix equals the multiplying vector length satisfied.
Swipe to show code editor
You have the selling data for a local furniture store stored in the sellings
matrix.
Month | Sofa | Armchair | Dining table | Dining chair | Bookshelf |
---|---|---|---|---|---|
March | 16 | 21 | 30 | 23 | 10 |
April | 40 | 39 | 13 | 21 | 16 |
May | 11 | 21 | 36 | 32 | 16 |
And vector of prices named prices
.
Sofa | Armchair | Dining table | Dining chair | Bookshelf |
---|---|---|---|---|
340 | 150 | 115 | 45 | 160 |
Your tasks are:
- Output the total number of items sold each month.
- Transpose of the
sellings
matrix and reassign the result to thesellings
variable. - Find out revenue by each good by multiplying
sellings
andprices
. Save the result to theincome
variable. - Output the monthly revenues.
- Output the total three months' revenue.
¡Gracias por tus comentarios!
Sales and Revenue
Let's consolidate acquired knowledge with a practical task!
Note
If you want to multiply each element of the row to a specific value (i.e., not one number for all elements), you need to have the condition: the number of rows of the matrix equals the multiplying vector length satisfied.
Swipe to show code editor
You have the selling data for a local furniture store stored in the sellings
matrix.
Month | Sofa | Armchair | Dining table | Dining chair | Bookshelf |
---|---|---|---|---|---|
March | 16 | 21 | 30 | 23 | 10 |
April | 40 | 39 | 13 | 21 | 16 |
May | 11 | 21 | 36 | 32 | 16 |
And vector of prices named prices
.
Sofa | Armchair | Dining table | Dining chair | Bookshelf |
---|---|---|---|---|
340 | 150 | 115 | 45 | 160 |
Your tasks are:
- Output the total number of items sold each month.
- Transpose of the
sellings
matrix and reassign the result to thesellings
variable. - Find out revenue by each good by multiplying
sellings
andprices
. Save the result to theincome
variable. - Output the monthly revenues.
- Output the total three months' revenue.
¡Gracias por tus comentarios!
Let's consolidate acquired knowledge with a practical task!
Note
If you want to multiply each element of the row to a specific value (i.e., not one number for all elements), you need to have the condition: the number of rows of the matrix equals the multiplying vector length satisfied.
Swipe to show code editor
You have the selling data for a local furniture store stored in the sellings
matrix.
Month | Sofa | Armchair | Dining table | Dining chair | Bookshelf |
---|---|---|---|---|---|
March | 16 | 21 | 30 | 23 | 10 |
April | 40 | 39 | 13 | 21 | 16 |
May | 11 | 21 | 36 | 32 | 16 |
And vector of prices named prices
.
Sofa | Armchair | Dining table | Dining chair | Bookshelf |
---|---|---|---|---|
340 | 150 | 115 | 45 | 160 |
Your tasks are:
- Output the total number of items sold each month.
- Transpose of the
sellings
matrix and reassign the result to thesellings
variable. - Find out revenue by each good by multiplying
sellings
andprices
. Save the result to theincome
variable. - Output the monthly revenues.
- Output the total three months' revenue.