Introduction To R PDF
Introduction To R PDF
Introduction To R PDF
Introduction to R
1/16
What is R?
2/16
What is R?
R is an interpreted programming language for statistical computing and graphics. It
is widely used in academia, by large companies, and by researchers. It is specifically
designed for doing statistical analysis.
2/16
What is R?
R is an interpreted programming language for statistical computing and graphics. It
is widely used in academia, by large companies, and by researchers. It is specifically
designed for doing statistical analysis.
Why use R for Data analysis?
2/16
What is R?
R is an interpreted programming language for statistical computing and graphics. It
is widely used in academia, by large companies, and by researchers. It is specifically
designed for doing statistical analysis.
Why use R for Data analysis?
I R is free to download and use.
2/16
What is R?
R is an interpreted programming language for statistical computing and graphics. It
is widely used in academia, by large companies, and by researchers. It is specifically
designed for doing statistical analysis.
Why use R for Data analysis?
I R is free to download and use.
I R is open-source.
2/16
What is R?
R is an interpreted programming language for statistical computing and graphics. It
is widely used in academia, by large companies, and by researchers. It is specifically
designed for doing statistical analysis.
Why use R for Data analysis?
I R is free to download and use.
I R is open-source.
I It is very easy to share your output from R.
2/16
What is R?
R is an interpreted programming language for statistical computing and graphics. It
is widely used in academia, by large companies, and by researchers. It is specifically
designed for doing statistical analysis.
Why use R for Data analysis?
I R is free to download and use.
I R is open-source.
2/16
What is R?
R is an interpreted programming language for statistical computing and graphics. It
is widely used in academia, by large companies, and by researchers. It is specifically
designed for doing statistical analysis.
Why use R for Data analysis?
I R is free to download and use.
I R is open-source.
2/16
What is R?
R is an interpreted programming language for statistical computing and graphics. It
is widely used in academia, by large companies, and by researchers. It is specifically
designed for doing statistical analysis.
Why use R for Data analysis?
I R is free to download and use.
I R is open-source.
2/16
What is R?
R is an interpreted programming language for statistical computing and graphics. It
is widely used in academia, by large companies, and by researchers. It is specifically
designed for doing statistical analysis.
Why use R for Data analysis?
I R is free to download and use.
I R is open-source.
2/16
What do we need?
3/16
What do we need?
Install R:
Go to R Link, select the version of R software applicable to your computer and
install the software.
3/16
What do we need?
Install R:
Go to R Link, select the version of R software applicable to your computer and
install the software.
Install RStudio:
Once you are done, download the RStudio installer. Go to R Studio Link, select the
applicable version of RStudio and install the software.
3/16
The Difference between R and RStudio
4/16
The Difference between R and RStudio
4/16
The Difference between R and RStudio
4/16
Four Pane of RStudio
I Console Pane
I R Script or Source Pane
I The environment and history pane
I The final pane
5/16
Four Pane of RStudio
6/16
Four Pane of RStudio
7/16
Assigning value to variables:
Make sure that the name you assign your variable is accurately descriptive and
understandable to another reader.
Reminders:
I R is case sensitive: It will tell the difference between uppercase and lowercase.
8/16
Assigning value to variables:
Make sure that the name you assign your variable is accurately descriptive and
understandable to another reader.
Reminders:
I R is case sensitive: It will tell the difference between uppercase and lowercase.
When assigning a value to an object, R does not print anything. You can force R to
print a value using the following syntax:
I (<object name/expression>)
I <object name>
I print(<object name/expression>)
9/16
Print out the values of the variable:
When we say print out, it simply means that all the values of the variable are
displayed in the console.
When assigning a value to an object, R does not print anything. You can force R to
print a value using the following syntax:
I (<object name/expression>)
I <object name>
I print(<object name/expression>)
9/16
Four Pane of RStudio
I Console Pane - output and error messages are displayed.
I R Script or Source Pane - you can type and save your commands and make
notes to yourself about projects.
I The environment and history pane is where you will see the different objects
you create or the different datasets you import.
10/16
Four Pane of RStudio
11/16
Steps to Install R Packages
2. In the Install Packages dialog, write the
1. Go to your final pane. Click Packages, then package name you want to install under the
click Install. Packages field and then click install. This will
install the package you searched for or give
you a list of matching packages based on your
package text.
12/16
Loading Data into R
Reminders:
I Make sure to attach your file to the R search path attach(). This means that
the database is searched by R when evaluating a variable, so objects in the
database can be accessed by simply giving their names. Detach the dataset
when you are done detach().
13/16
Extracting Column from a Data Frame in R
<dataframe>$<column>
Exercise 3: Select a column from the SAMPLE DATA Excel file, save it to the
variable column 1, and print it.
14/16
Basic Data Types in R
15/16
Basic Data Types in R
R works with numerous data types. Some of the most basic types to get started are:
15/16
Basic Data Types in R
R works with numerous data types. Some of the most basic types to get started are:
I Number values like 3.6 are called numerics. These values are recognized in R
as is.
15/16
Basic Data Types in R
R works with numerous data types. Some of the most basic types to get started are:
I Number values like 3.6 are called numerics. These values are recognized in R
as is.
I Boolean values true or false are called logical. They are recognized in R as
TRUE or T for true and FALSE or F for false.
15/16
Basic Data Types in R
R works with numerous data types. Some of the most basic types to get started are:
I Number values like 3.6 are called numerics. These values are recognized in R
as is.
I Boolean values true or false are called logical. They are recognized in R as
TRUE or T for true and FALSE or F for false.
I Text (or string) values are called characters. Characters in R are recognized
with ”” or ”.
15/16
Basic Data Types in R
R works with numerous data types. Some of the most basic types to get started are:
I Number values like 3.6 are called numerics. These values are recognized in R
as is.
I Boolean values true or false are called logical. They are recognized in R as
TRUE or T for true and FALSE or F for false.
I Text (or string) values are called characters. Characters in R are recognized
with ”” or ”.
To check the data type of a variable, use the class function.
Syntax: class(<expression>)
15/16
References
I UOFT Coders
I Monash Bioinformatics Platform
I Bookdown
Thank You!
16/16