Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
TRAINING
Prepared by:
Ms. KATRINA D. ELIZON
Faculty Member
Department of Mathematics and Statistics
WHY DATA SCIENCE?
By Thomas H. Davenport and D.J. Patil
WHAT IS DATA
SCIENCE?
DATA SCIENCE
https://www.edureka.co/blog/what-is-data-science
https://www.edureka.co/blog/what-is-data-science
REQUIRES SKILLS FOR
DATA SCIENTIST
https://www.edureka.co/blog/what-is-data-science
DATAFICATION
D a t a fi c a t i o n i s a m o d e r n
technological trend turning many
aspects of our life into data
which is subsequently transfer
into information realised as a
new form of value.
Basics
CONSOLE PANE
The console is the
heart of RStudio. You
can type commands
directly into the
console whenever you
see the flashing cursor.
Output and error
messages are displayed
in the console.
R SCRIPT OR SOURCE PANE
The script or source pane is
where you can type and save
your commands and make
n o t e s t o yo u r s e l f a b o u t
projects. When you run a
command from the source
pane, the command is sent
over to the console pane to be
executed. It is possible to have
multiple sources or scripts
appear in the source pane,
and they will each have their
own tab at the top of the pane.
ENVIRONMENT AND HISTORY
PANE
Poker Roulette
On Monday you won P14,000 On Monday you lost P2,400
Tuesday you lost P5,000 Tuesday you lost P5,000
Wednesday you won P2,000 Wednesday you won P10,000
Thursday you lost P12,000 Thursday you lost P35,000
Friday you won P24,000 Friday you won P1,000
NAMING A VECTOR
How much has been your overall profit or loss per day
of the week?
Exponentiation ^
A function that helps you answer
this question is sum ( ). It calculate
the sum of all elements of a vector.
There are two ways to calculate the
overall winnings. Get the sum of
total_daily vector, or add the
total_poker and total_roulette vector.
VECTOR SELECTION
th
m
The entire row of a matrix can be extracted
as matrixname[m,].
th
Similarly, the n column of a matrix can be
extracted by matrixname[,n].
EXTRACT A ROW AND
COLUMN FROM A MATRIX
To extract more than one rows or
columns at a time.
Multiple rows:
matrixname[c( ),]
Multiple columns:
matrixname[,c( )]
EXTRACT A ROW AND
COLUMN FROM A MATRIX
th th
An element at the m row, n column of a
matrix can be accessed by the expression
matrixname[m,n].
th
m
The entire row of a matrix can be extracted
as matrixname[m,].
th
Similarly, the n column of a matrix can be
extracted by matrixname[,n].
HOW TO CREATE A
DATA FRAME IN ?
If/else statements
In R, we can write a conditional if/else
statement as follows:
ifelse(condition on data, true value
returned, false returned)
EXAMPLE:
Suppose we want to create a variable
called grades that is assigned as follows:
E for score less than or equal to 60
D for score 61 to 70
C for score 71 to 80
B for score 81 to 90
A for score at least 91
STRING
OPERATIONS
IN R
You can create strings with either
single quotes or double quotes.
Base R contains many functions to
work with strings but we’ll avoid
them because they can be
inconsistent, which makes them
hard to remember. Instead we’ll
use functions from stringr.
Apply str_length( ) to determine
the number of characters in a
string_vector.
EXAMPLE: