Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, can you please help me with my R homework? Matrix Operations 1. Create a vector, age, with following numbers 42,40,17,14,1. 2. Create a vector,

Hello, can you please help me with my R homework?

image text in transcribed

Matrix Operations 1. Create a vector, age, with following numbers 42,40,17,14,1. 2. Create a vector, salary, with following numbers 5000, 5000, 2000, 1750, 0 3. Create an empty matrix, employers to store the ages and salaries of five employers of a company. 4. Fill the ages and salaries of the employers in the matrix that your create previously. (Use the vectors age and salary to fill the matrix. If you fill the matrix by hand you will not get the point) Question 2. Factor Operations 1. Create a factor vector to store the names of employer and fill it with following names Peter, Lois, Meg, Chris, Stewie 2. Create a factor vector to store the sex of the employer and fill it with following sexes M, F, F, M, M 3. What are the levels of sex factor? Prove with R code. Question 3. Operations 1. Write the code to show the names of the people whose salaries are exactly 5000 dollars. 2. Write the code to show the ages of the people whose salaries are more than 1000 dollars. 3. Change the age and salary of Stewie in the following way (a) Find the index of Stewie (b) Use this index to reach its age and change the age to 50 (c) Use the same index to reach its salary and change the salary to 7500 4. Write the code that outputs following sentence; "Peter is a male person at 42 ages. His salary is 5000 dollars." (Bold words will be used as variable. Do not copy and paste the sentence. Write the necessary codes. Imagine that your codes will be generalized for 5000000 records in the following step)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions