Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Samenvatting volledig script voor statistiek A

Rating
5.0
(1)
Sold
-
Pages
8
Uploaded on
11-09-2024
Written in
2023/2024

Met dit script behaalde ik 19/20 op het examen (samen met samenvatting leerstof)

Institution
Course

Content preview

PDF-principe

#Packages laden

library(car)

library(moments)

#R-bestand inladen

load(file.choose())

#csv-bestand inladen

Naam <- read.csv2(file.choose())

#Functies inladen

source(file.choose())

#handmatige methode voor pakketten inladen => aanklikken

#handmatige methode R-bestand inladen => file → open file

#handmatige methode CSV-Data inladen => import Dataset → From tekst (base) → (settings ok?) → import

#handmatige methode functies inladen => file → open file → source


Data aanmaken

#Vector + variabele maken

Naam <- c("Amy", "Marlies", "Adinda")

#aanmaken nieuwe variabele en toevoegen aan Dataframe volgnummers 1 tot 5000

Data$Variabele <- seq(1,500)

#Variabele uit Dataframe selecteren

Data$Variabele

#bestaande Dataframe bewerken

fix(Data)

#Dataframe maken van losse vectoren

Data <- Data.frame(Variabele, ID, Leeftijd, Voornaam, Werkstudent, Namen)

#Herhalingen maken van gegevens bv. 1,1,1,2,2? Met opmerkingen [CD1]: Samenvatting p15

Naam <- c(rep(1,3),rep(2,2))

OF Naam <- rep(c(1,2),c(3,2))

#reeks cijfers

Naam <- rep(1:10)

#Reeks opeenvolgende cijfers maken bv. 1,2,3,4,5 in stappen van 0.5

seq(1,5,0.5) seq( a,b,c) met a = beginwaarde, b = eindwaarde, c = eventuele stapgrootte

#Deel van Databestand nemen

Data(1:10,c(9,15,16)) rij 1 tot en met 10 kolom 9, 15, 16

, #Kenmerken bekijken (levels, class) checken of factor geordend is

attributes( )

Factor versus numeriek

#checken of de variabele een factor/numeriek is

is.factor(Data$Variabele)

is.numeric(Data$Variabele)

#wijziging variabele in factor

Data$Variabele.f <- as.factor(Data$Variabele)

#wijziging variabele in numerieke

Data$Variabele.f <- as.numeric(Data$Variabele)




Hercoderen

#voor hercoderen: al juist?

table(Data$Variabele)

#hercodeer je een (factor) variabele (en toevoegt aan het Databestand)

Data$Variabele.f <- recode(Data$Variabele, "1='Vlaanderen';2='Nederland'", as.factor = T) Met opmerkingen [CD2]: " 'A'='hoog' ; 'B'='laag' "

#hercodeer je een variabele, maak je een ordening in de volgorde (bij factor) Met opmerkingen [CD3R2]: " T='waar' ; F = 'niet waar' "
Met opmerkingen [CD4R2]: " lo:6 = '0' ; 6:hi = '1' "
Data$Variabele.f <- recode(Data$Variabele, "0:6='Goed'; 6:10='Zeer goed'", as.factor=T)
Met opmerkingen [CD5]: Element 0 tot 6 noemen we
#Na hercoderen nakijken of juist gehercodeerd is!!! goed
Met opmerkingen [CD6R5]: Ondergrens zit er niet bij,
table(Data$Variabele,Data$Variabele.f) bovengrens wel

is.factor(Data$Variabele) #true?

#Nakijken ordening (en aanpassen)

levels(Data$Variabele.f)

Data$Variabele.fo <- factor(Data$Variabele.f, ordered = T, levels = c('Goed','Zeer goed')) Met opmerkingen [CD7]: Hier volgorde plaatsen die je
wilt


VERSCHILLENDE SOORTEN VOORSTELLINGEN
#absolute frequentie opvragen

table(Data$Variabele)

#Relatieve frequentie opvragen en omzetten in procent

prop.table(table(Data$Variabele))*100

#Frequentietabel opvragen

freqtabel(Data$Variabele)

Written for

Institution
Study
Course

Document information

Uploaded on
September 11, 2024
Number of pages
8
Written in
2023/2024
Type
SUMMARY

Subjects

$9.60
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF


Also available in package deal

Reviews from verified buyers

Showing all reviews
1 year ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
StudentUantwerpenOOW Universiteit Antwerpen
Follow You need to be logged in order to follow users or courses
Sold
127
Member since
1 year
Number of followers
2
Documents
20
Last sold
1 month ago

4.4

14 reviews

5
11
4
1
3
0
2
0
1
2

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions