r programming 1st lab program
r programming 1st lab program
Download and install R-Programming environment and install basic packages using
install. packages () command in R.
Introduction to R programming:
R is a programming language and free software developed by Ross Ihaka and Robert Gentleman in 1993. R
possesses an extensive catalog of statistical and graphical methods. It includes machine learning algorithms,
linear regression, time series, statistical inference to name a few. Most of the R libraries are written in R, but
for heavy computational tasks, C, C++ and Fortran codes are preferred. R is not only entrusted by academic,
but many large companies also use R programming language, including Uber, Google, Airbnb, Facebook
and so on.
Data analysis with R is done in a series of steps; programming, transforming, discovering, modeling and
communicate the results.
Program: R is a clear and accessible programming tool
Discover: Investigate the data, refine your hypothesis and analyze them
Model: R provides a wide array of tools to capture the right model for your data
Communicate: Integrate codes, graphs, and outputs to a report with R Markdown or build Shiny apps to
share with the world
Statistical inference
Data analysis
Machine learning algorithm
Step – 1: With R-base installed, let’s move on to installing RStudio. To begin, goto
download RStudio and click on the download button for RStudio desktop.
Step – 2: Click on the link for the windows version of RStudio and save the .exe file.Step – 3:
Enter/browse the path to the installation folder and click Next to proceed.
Select the folder for the start menu shortcut or click on do not create shortcuts and thenclickNext.
Installing Packages:-
The most common place to get packages from is CRAN. To install packages from CRAN you
use install.packages("package name"). For instance, if you want to install the ggplot2
package, which is a very popular visualization package, you would type the following in the
console:-
Syntax:-
# install package from
CRAN
install.packages("ggpl
ot2") Loading
Packages:-
Once the package is downloaded to your computer you can access the functions and
resources provided by the package in two different ways:
# load the package to use in the current R
sessionlibrary(package ename)
Getting Help on Packages:-
For more direct help on packages that are installed on your computer you can use the help
and vignette functions. Here we can get help on the ggplot2 package with the following:
help(package = "ggplot2") # provides details regarding contents of a package
vignette(package = "ggplot2") # list vignettes available for a specific package
vignette("ggplot2-specs") # view specific vignette
vignette() # view all vignettes on your computer