Introduction To R Programming PDF
Introduction To R Programming PDF
S1: Install R by clicking on download R at https://www.r-project.org/ and following the
instructions.
● Get a copy of the folder R_Files-1 from your instructor. The .r extension is used for
R source/script files.
● Start RGui and open R01_2_1_InstallingR.R as shown below:
● Starting from the top of the file, navigate to the beginning of each line (that does not start
with #) and press CTRL+R to run it. Try to figure out what each line of code does.
● Once you are done, use CTRL+L to clear the console.
● Run line 21 to install the following commonly used contributed packages using pacman.
dplyr, GGally, ggplot2, ggthemes, ggvis, httr, lubridate,
plotly, rio, rmarkdown, shiny, stringr, tidyr
Note: this line can be run even without loading pacman.
● You should be able to confirm installation and loading of all these contributed packages:
● Take SCREENSHOT 2 - it should show the entire RStudio window and the four
packages beginning with the letter G should be checked in “Packages”.
● Unload the contributed packages, base packages, and clear the console.
source: http://suruchifialoke.com/img/ML/iris.png
● You may run ?plot() to display information about plot() in the Help window.
● Run each line of uncommented code and try to figure out what it does.
● Write a line to create the following plot. Remember to replace <CMS ID> in title with
your own CMS ID. You can use whatever colour you like best. Also remember to include
the axes titles.
● Take SCREENSHOT 3 - it should show the R code used to generate the plot. Your
screenshot should also include your Plots window.
● Write three lines to create the following plot. Remember to replace <CMS ID> in title
with your own CMS ID. You can use whatever colour you like best. Please ensure the
range of values for the x-axis and y-axis are as shown and that the axes intersect at the
origin. The axes labels should also be included.
● Take SCREENSHOT 4 - it should show the R code used to generate the plot. Your
screenshot should also include your Plots window.
● Write three lines to create the following plot. Remember to replace <CMS ID> in title
with your own CMS ID.
Hint: the first plot in the Examples section of the Help window can be modified to
create this plot. Remember to take note of what is happening in the Environment
window.
● Take SCREENSHOT 5 - it should show the R code used to generate the plot. Your
screenshot should also include the Plots and window Environment window.
● You are recommended to copy, run, understand all lines in the Examples section of the
Help window.
SUBMISSION: Instructions
● Convert the following into one PDF file and upload on the LMS submission link by the
due date:
○ Screenshot 1 to 5.