Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Based on what we have learned about R so far, answer the following questions. The copy and paste the commands and the results into

image text in transcribed

2. Based on what we have learned about R so far, answer the following questions. The copy and paste the commands and the results into the same Word file as problem #1 above. 1. Create a vector of these animals: 'cat', 'dog', 'fish', 'elephant', 'lion'. 2. Give a name for each of these animals (e.g. the cat's name is Mitzi', etc. ) using the names() function. But the lion has no name, so it will have NA instead of its name. Show the names of the animals once you set them up. 3. Keep only the animals with names in the vector and "rename" the remaining animals as either "male" or "female". 4. Replace the male animals with "NoBaby", and the female animals with "WithBaby" 5. Create a matrix with elements as annual salaries in a company from 4 departments as follows: Department A salaries: 45000, 34000 43000 51000, Department B salaries: 28000, 87000, 76000,44000, Department C salaries: 75000, 87000 93000 51000, Department D salaries: 47500, 33476, 49850, 71900. 6. Create a name list for the rows and columns of your matrix, e.g. Dept A, Dept B, Dept C, DeptD, and then Pers1, Pers2, ....Pers5. 7. Remove the entire Department C data from the matrix. 8. Calculate the mean, median and standard deviation of salaries by department. 2. Based on what we have learned about R so far, answer the following questions. The copy and paste the commands and the results into the same Word file as problem #1 above. 1. Create a vector of these animals: 'cat', 'dog', 'fish', 'elephant', 'lion'. 2. Give a name for each of these animals (e.g. the cat's name is Mitzi', etc. ) using the names() function. But the lion has no name, so it will have NA instead of its name. Show the names of the animals once you set them up. 3. Keep only the animals with names in the vector and "rename" the remaining animals as either "male" or "female". 4. Replace the male animals with "NoBaby", and the female animals with "WithBaby" 5. Create a matrix with elements as annual salaries in a company from 4 departments as follows: Department A salaries: 45000, 34000 43000 51000, Department B salaries: 28000, 87000, 76000,44000, Department C salaries: 75000, 87000 93000 51000, Department D salaries: 47500, 33476, 49850, 71900. 6. Create a name list for the rows and columns of your matrix, e.g. Dept A, Dept B, Dept C, DeptD, and then Pers1, Pers2, ....Pers5. 7. Remove the entire Department C data from the matrix. 8. Calculate the mean, median and standard deviation of salaries by department

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

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

Students also viewed these Databases questions

Question

outline some of the current issues facing HR managers

Answered: 1 week ago