Professional Documents
Culture Documents
Data Types
Operators
Data Structures
Data Types
R Studio Tabs
Operators
Basic Tips
Data Structures
Console Pane
Environment Pane
Used in running a code. You can
Files Pane also run code by pressing
Ctrl+Enter
The source pane is a text
editor where you can
type your code before You can write a comment by adding # to an RScript
R will run the line where you placed your cursor
running it.
Source Pane
Console Pane
Environment Pane
Source Pane
To remove all the objects from the environment
Console Pane
Environment Pane Environment tab displays any objects that you have
created during your R session
Files Pane
To see all the objects in the current session, type ls()
The Environment Pane
To remove a specific object use rm(…)
includes an Environment
tab, History tab,
Connections tab and
Tutorial tab
Source Pane
Console Pane
Environment Pane History tab keeps a record of all the commands you have run
Files Pane To copy a command from the History into the console, select the
command and press Enter or click
The Environment Pane
includes an Environment If you want to copy the command into the script, select the
command and press Shift+Enter or click
tab, History tab,
Connections tab and
Tutorial tab
Source Pane
Console Pane
Environment Pane
Files Pane
The Files tab displays the content of your working directory
The Files Pane includes You can find out which directory R is using by typing getwd() in the
several tabs that provide command line
useful information To change working directory type setwd(“H:/Preferred Directory”)
Notice that you need a forward slash (/) and not back slash (\)
If you do not see the contents of the file directory in the Files tab, click on
and then on
Source Pane
Console Pane
The Plot tab shows all graphs that you have created
Environment Pane
Source Pane
Console Pane The packages tab displays the R packages that you have installed in your System
Environment Pane Library. To install a package you can use the command install.packages(“package
name”) . Once you have it installed the package, you need to load it using the
Files Pane command library(package name).
An R package typically
includes code, data,
documentation for the
package and the function If there is a check mark beside the package, it means that it is already loaded
inside, and tests to check
everything works as it
should
Once a package is installed, you do not need to reinstall the package. If you want
to use a package, you have to load it every time you start a new RStudio session
Stat20023: Engineering Data Analysis
R Studio Tabs Basic Tips R Objects
Source Pane
Files Pane
The Usage section shows the function and the variables that
The Help tab has built-in need to be specified
documentation for
packages and functions in
R.
Source Pane
Console Pane The Value section specifies what is returned by the function. R
documentation may also include references, a list of similar functions, and
Environment Pane examples.
Files Pane
a 1trial
b $
F00 ^mean
my_var 2nd
.day !day
Complex “negative”
Complex 0
Character
Numeric TRUE
Integer FALSE
Logical
Complex
Character
z = 1 + 2i
Numeric
sqrt(-9+4i)
Integer
Logical sqrt(-25 + 0i)
Complex
Character
z = 1 + 2i
Numeric
sqrt(-9+4i)
Integer
Logical sqrt(-25 + 0i)
Complex
Assignment Operators =
!= Not equal to
Assignment Operators
FALSE FALSE FALSE
Arithmetic Operators
FALSE TRUE TRUE
Relational Operators
TRUE FALSE TRUE
Logical Operators
TRUE TRUE TRUE
Assignment Operators
FALSE FALSE FALSE
Arithmetic Operators
FALSE TRUE FALSE
Relational Operators
TRUE FALSE FALSE
Logical Operators
TRUE TRUE TRUE
c(1, 2, 3)
c(TRUE, FALSE)
list(101,”Stat”)
list(TRUE, 2+5i)
[ , 1] [ ,2 ] [ , 3]
matrix(c(1:6),nrow=2)
[ 1, ] 1 3 5
[ 2, ] 2 4 6
array(c(vector1, vector2),dim=c(3,3,2))
Factors are objects which are used to categorize the data and
store it as levels
as.factor(data)
Name Age
Tim 24
Ace 18
Stat20023: Engineering Data Analysis
Loading Data