Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started