Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Samenvatting

Summary Data Science 144 Practical Summaries

Beoordeling
-
Verkocht
2
Pagina's
17
Geüpload op
02-09-2022
Geschreven in
2022/2023

Summaries of all concepts needed in data science 144 practicals, namely RStudios. Practicals 1-5 are covered.

Instelling
Vak

Voorbeeld van de inhoud

Notes on tutorial I

I
scripts
A text file that holds R code







extent ion / R

:
- r .




projects
Places where you can keep all the files associated with a
project :
input data, scripts ,
results, graphs
>
.
Rproj
> command : Open Project


Lessons from swirl 1)




① Basic building blocks



store results in a variable 5+7 →
y
:




data that contains data ) numbers

vector : a structure ( object containing a small collection of

> create with the cc ) function

> e. g. C C 1.1
,
9 3.14 )
,

function name

function ?c

more info on a
particular : <
no
parenthesis

vectors can be used in mathematical expressions
' '
Y
'

arithmetic operators :
' ' '

'
+ -
n
, , ,






square root :
sqrtc )

absolute value : dbsc )


with vectors of the same length ,
r
simply performs the arithmetic operation element -




by -

element

if vectors of different lengths the shorter until length
'
is the
'

are R recycles vector it same as
,




the longer Vector
; e.
g. 2 * 2 + 100 =
2 * c ( 2,2 , 2) + C C 100
,
100
,
100 )


( 1 2 3)
C , ,




CCI , 2,3 4) C (0 10 )
e.
g. ,
+
,



→ C C 1 2 3, 4) + C CO 10 0 10 )
, , , , ,




object length is not multiple of shorter object length !
"
= I 12 3 14
warning ! longer a

,② workspace and files

R provides a common API ( set of commands ) for interacting with files



determine current
working directory :
getwd C)


list all objects local ISC )
in workspace

:






workspace : what is loaded or created in R 's
memory that can be accessed in this session

variable then Isis throw
"
if you
"
e.
g. assigned 9 to a ×
,
will x



list all the files in your working directory using list .fi/esc ) or dirt )

use
argsl ) to see what arguments a function can take
"


directory in the working directory dir
"

create a current :
.
create c)

• set
your working directory to another directory :
setwdlf.name "





create a file in
your working directory : file create 1)
.




check if file file exists C)

a exists in the working directory : .






access information about the file : file info 1) .




items $ file .info / ) $
" "


grab specific :
operator my test R
project




; e.g .
.





rename files : file . rename / from
,
to )

delete a file : file remove c)
variables
.




see all
make of the file file 1
" "
)
a
copy :
copy Isc )





workspace :
.




in


provide the relative path to the file : file path .
c)
clear your workspace :
• make a platform-independent pathname : file .


path Cm
,
m )

( list Isu )
directories dir create rm =

to create paths / : .






to create nested directories ,
'
recursive '
must be set to true
'
( testdir ' '
)
'

> e.
g. dir create ( file . .
path testdirz recursive = TRUE )
, ,




③ Sequences of numbers





operator > : creates a sequence of
integers
e.
g.
1 : 4 throws I 23 4


e.
g. pi : 10 creates a
sequence of real numbers :
3,14 . . .



4,14 . . .
5
,
14



4 : I 4 3 2 I
e.
g. >



control
more over a
sequence seqc )
• :




increment by x :

seqcl ,
10
, by = > c)

random of numbers c 5 length 30 )
sequence y seq 10

: =
,
,



check length of a
sequence :
length c) between sand to

, of length of another sequence :
create a
sequence





> 1 :
length 1)
with
seq c along my sequence )
> =
. _




seq along
( my
seq)
>
_ _




number : 40)
replicate a repcx times

=
,



10 )
replicate a vector
rep Coco times

:
, 1,23 , =







replicate each number a certain amount of times :
repccco 1,23 ,
,
each =D




④ Vectors


atomic vectors : one data type ,
e.
g. numeric
, logical ,
character , integer and complex
lists :
multiple data types


Logical vectors


• values : TRUE , FALSE NA
,




e.
g. num -
Vec < 1 tells us if values are smaller than 1 or not

& !
>
Logical operators !
!
= = = = =
:
, , , , , ,

,
and ,
not




character vectors



double
quotes to distinguish character objects
between chars
space
is )
" "

(
" " "


My
"

C name
e.
g. , , ↓
"


)
"



join characters of the char vector into single string ( my char collapse
a
paste
◦ =
:
_


,

"

)
"


concatenate :c ( my _
Char ,
m




)
" " "



join char ( world !
"


paste
"
vectors Hello
"
:
Sep
• =

, ,




⑤ Missing values


placeholder for unavailable
> NA : not available ( an
quantity )

create a vector
containing 1000 draws from a standard normal distribution : rnorm ( 10007


choose a random sample of 100 elements
combining 2 vectors : sample ( cc y 27,100) ,





check if elements are NA : is .naC ]


TRUE I



FALSE 0


i. SUM of TRUE and FALSE gives us the number of TRUES !


> NaN : not a number e.g .
010
,




> Inf :
infinity

Gekoppeld boek

Geschreven voor

Instelling
Vak

Documentinformatie

Heel boek samengevat?
Nee
Wat is er van het boek samengevat?
Practicals 1 - 5
Geüpload op
2 september 2022
Aantal pagina's
17
Geschreven in
2022/2023
Type
SAMENVATTING

Onderwerpen

€8,81
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
miaolivier16 C
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
740
Lid sinds
6 jaar
Aantal volgers
465
Documenten
24
Laatst verkocht
5 dagen geleden
Hoërskool opsommings :)

Ek bied aan volledige, hoë- kwaliteit opsommings vir hoërskool studente. Sien ook my instagram profiel @_ op instagram vir ‘n wyer reeks opsommings of om meer inligting te kry.

4,5

122 beoordelingen

5
77
4
30
3
10
2
3
1
2

Populaire documenten

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen