Generate 3 student name gender gpa and grade vectors you


Managing and Understanding Data (Class Exercise)

R data structures:

1. Generate 3 student name, gender, gpa and grade vectors. You could use names such as "Henry Grant", "Amy Becker", "Bessie Kim"; use gender such as "male","female", "female"; use gpa such as 3.5, 3.7, 3.2; use grades such as "senior", "sophomore", "junior".

2. Access the gender of second student and access the first two students' grades.

3. Change vector gender into a factor vector with levels female and male; also change vector grade into a factor vector with levels freshman, sophomore, junior and senior.

4. Create a data frame using student information you generated above with stringsAsFactors set to False; Display the data frame and see how many rows and how many columns does this data frame have?

5. Access student gpa column; get student name and grade by specifying a vector of names.

6. Access student information in row 1 and column 2. What is it?

7. Access student information in row 2 & column 3 and in row 3 & column 4 together using vectors. What does the output look like?

8. Output student information in column 2 (all rows), then in row 3 (all columns) and then all rows & all columns.

9. Create a 4*2 matrix M using characters from 'a' to 'h'; Create a 3*3 matrix N usingcharacter from 'a' to 'i'.

10. Extract values from matrix. What character in M do you have in row 2 and column 1? What character in N do you have in row 3 and column 2?

11. Extract the second row (all columns) of matrix M; extract the third column (all rows) of matrix N.

Solution Preview :

Prepared by a verified Expert
Business Economics: Generate 3 student name gender gpa and grade vectors you
Reference No:- TGS02422168

Now Priced at $20 (50% Discount)

Recommended (96%)

Rated (4.8/5)