Question: R PROGRAMMING LANGUAGE 4. Basic operations with the iris data Run the following code to load iris data. data(iris) a. Inspect the data types of
R PROGRAMMING LANGUAGE
4. Basic operations with the iris data Run the following code to load iris data. data(iris) a. Inspect the data types of the variables in the iris data. - Hint: use str. b. (1 pt) Print the first few rows and the last few rows. c. (2 pts) Compute the maximum, minimum, mean, and standard deviation of the Petal. Length variable. d. (1 pt) What is the 130th value of the petal.Length variable? e. (1 pt) Change the 130th value of the Petal. Length variable to 0 . And then compute the mean of the Petal. Lenth variable. What is the difference between the current mean and the previous mean? 5. Working with two vectors. The sample correlation coefficient (r) is used to measure how strong a relationship is between two variables. Mathematically, the sample correlation coefficient of the data pairs (xi,yi),i=1,2,,n, is defined by: r=i=1n(xix)2i=1n(yiy)2i=1n(xix)(yiy) where x is the mean of xi 's and y is the mean of yi 's. Let's calculate the sample correlation coefficient between two variables, Sepal. Length and Sepal.Width, in the iris data using the above formula. You can directly work with iris\$5epal. Length and iris\$5epal. Width variables for the computation, but their names are too long. To make it simple, let's define new vectors x and y as follows: x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
