Question: Exercises Write a program using R language to create a vector vec1 from 0.1 to 1 with an increment of 0.1. Find the length of
Exercises
- Write a program using R language to create a vector vec1 from 0.1 to 1 with an increment of 0.1.
- Find the length of this vector.
- Next create a 5x2 matrix called mat1 using vec1.
- Name each row and column as row1, col1, etc.
- Change the value of the element located in the 3rd row and 2nd column to 10.
- Print both the 3rd row and the 2nd column.
- Hints:
- Use seq() function to generate a sequence of numbers with certain increment.
- Search in R Documentation for matrix() function to see how to give names to rows and columns. Basically create two vectors and initialize them with the names, then pass these two vectors as a list to matrix() function as the value of dimnames
- Write a program using R language to create the following data frame and call it practiceDF.
- Include your name in the first row, and then also include the following information.

- Create a second data frame from practiceDF by dropping the first two columns and call it practiceRes.
- Create a third data frame from practiceDF by dropping the following rows: 2, 4, 5, 8, and 9 and call the new data frame as practiceQual.
- Hints: Use subset() function to return a subset from the data frame. Search R Documentation to see how this function can be used to select vectors which meet certain conditions.
- Write a program using R language to convert temperature measurements from Fahrenheit, F, to Celsius, C, using the following equation:
- C=59(F32)
- Test your program using the following vector of Fahrenheit values: (45, 77, 19, 101, 120)
Usage Matrix (data NA, nrowl, ncol-i, byrow FALSE, dimnames=NULL, sparse - NULL, doDiag - TRUE, forceCheck = FALSE) 3. yes VOUAWN name score attempts qualify 1 Anastasia 12.5 1 Dima 9.0 no 3 Katherine 16.5 yes James 12.0 no Emily 9.0 no Michael 20.0 yes Matthew 14.5 yes Laura 13.5 no Kevin 8.0 no Jonas 19.0 1 yes MNMNMN 2. 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
