Question: Please write the entire R program in Rstudios Data frame in Janka.xlsx files contain two meaningful attributes. Please write the R program that reads file
Please write the entire R program in Rstudios
Data frame in Janka.xlsx files contain two meaningful attributes. Please write the R program that reads file janka.csv and then computes:
1. mean, variance and standard deviation for every attribute
2. covariance between attributes (i.e. covariance matrix),
3. histograms for each attribute assuming samples are drawn from probability distribution
4. Experimental CDF for each attribute and plot it
5. quintiles for each attribute with a step 0.1
6. quantile-to-quintile plot between attributes
Plots should be saved to files named as a plot itself (e.g. histogram-your last name.jpg) Assume that you are reading files from and writing files to Rs working directory. The program should be submitted as saved in the file Janka-Vizual-your last name.R Notes: To read .xlsx file into R you may need to install xlsx package. Then use the following operators: require(xlsx) data = read.xlsx2("janka.xlsx", 1) where data is a variable that will contain imported data as data.frame type. However, if you do it literally as described above then all your attributes will default to being factors while you need numerical values. So read carefully description of read.xlsx2 and use it properly.
Experimental CDF is computed by ecdf built-in function/object. You can use plot method on it to plot eCDFs. Use ? function to learn about ecdf and its methods.
There are 2 methods of saving plots in .jpg files: 1. Saving from R-studio. Click on export in plot pane and save 2. Use jpeg operator, e.g. jpeg("ecdf-density.jpg"). If you do so then after saving the plot you need to turn the device invoked for the plot off by including dev.off() operator.
All other functions are described
- The following is the data in file that is janka in MS excel:
| Density | Hardness | |
|---|---|---|
| 1 | 24.7 | 484 |
| 2 | 24.8 | 427 |
| 3 | 27.3 | 413 |
| 4 | 28.4 | 517 |
| 5 | 28.4 | 549 |
| 6 | 29.0 | 648 |
| 7 | 30.3 | 587 |
| 8 | 32.7 | 704 |
| 9 | 35.6 | 979 |
| 10 | 38.5 | 514 |
| 11 | 38.8 | 1070 |
| 12 | 39.3 | 1020 |
| 13 | 39.4 | 1210 |
| 14 | 39.9 | 989 |
| 15 | 40.3 | 1160 |
| 16 | 40.36 | 1010 |
| 17 | 40.7 | 1100 |
| 18 | 40.7 | 1130 |
| 19 | 42.9 | 1270 |
| 20 | 45.8 | 1180 |
| 21 | 46.9 | 1400 |
| 22 | 48.2 | 1760 |
| 23 | 51.5 | 1710 |
| 24 | 51.5 | 2010 |
| 25 | 53.4 | 1880 |
| 26 | 56.0 | 1980 |
| 27 | 56.5 | 1820 |
| 28 | 57.3 | 2020 |
| 29 | 57.6 | 1980 |
| 30 | 59.2 | 2310 |
| 31 | 59.8 | 1940 |
| 32 | 66.0 | 3260 |
| 33 | 37.4 | 2700 |
| 34 | 68.8 | 2890 |
| 35 | 69.1 | 2740 |
| 36 | 69.1 | 3140 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
