Question: mainly need the code for 4-7 Tasks: Please write an R script that performs the following operations in the order listed. At the beginning of
Tasks: Please write an R script that performs the following operations in the order listed. At the beginning of each task, write a comment marking the task number. Name the file as: lab2-.R 1. Create a vector with 10 numeric values using the colon operator. Coerce the numeric data to integer. Check the output and data type both before and after the coercion. 2. Create a vector with 100 numeric values starting from 10 , with each value equal to the previous value +8. Check output. 3. Create a vector with at least 50 data elements repeating 6 different words of your choice. Check output. 4. Create a matrix with 5 rows and 4 columns. Coerce the matrix to data frame. Check the output and data type both before and after the coercion. 5. Create a data| frame with 3 columns and 20 rows. The first column should contain 4 different values from 1 to 4 . Check output. Define the first column/variable as a factor with 4 levels. Check output. Create labels for each level of the factor. Check output. 6. Export the data frame your created in task 5 to a txt file titled "export.txt". Import "export.txt" to a data frame using the R built-in function. 7. Export the data frame your created in task 5 to a csv file titled "export.csv". Import "export.csv" to a data frame using the R built-in function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
