100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4,6 TrustPilot
logo-home
Resumen

Samenvatting Statistics for Psychologists, part 3 + R cheatsheet

Puntuación
-
Vendido
-
Páginas
15
Subido en
22-05-2025
Escrito en
2024/2025

Samenvatting van alle hoofdstukken en simulations. Gemaakt voor het schakelprogramma van de master Psychologie voor het vak Statistics for Psychologists, part 3 voor de examenperiode van juni 2025. Zie de tags voor de verschillende onderwerpen. Het document heeft 14 bladzijdes en is gemaakt in mijn gebruikelijke sjabloon (gebruik van kleur en meestal volzinnen, maar een duidelijke structuur). Hierin staat de absolute theoretische basis van het vak, maar met de samenvatting te kopen krijg je ook toegang tot mijn cheatsheet voor R, een zeer uitgebreid en gedetailleerde opsomming en uitleg van alle nodige codes. Vergeet dus zeker geen oefeningen te maken. Let op! Deze samenvatting is in het Engels (net als het vak).

Mostrar más Leer menos
Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Estudio
Grado

Información del documento

Subido en
22 de mayo de 2025
Número de páginas
15
Escrito en
2024/2025
Tipo
Resumen

Temas

Vista previa del contenido

STAT3 – juni 2025 1




INTRODUCTION TO R

SIMPLE CALCULATIONS

ORDER OF OPERATION
R uses the BEDMAS order of operation:
1) Brackets ()
2) Exponents ^
3) Division / and Multiplication *
4) Addition + and Subtraction -
 If we want to force R to calculate, for example, the addition in a command first, we have to enclose it in
brackets

For operations on the same level (e.g. division and multiplication), R will go from left to right

VARIABLES
= a label for a certain piece of information, or even several different pieces of information
- To assign a value to a variable, we use the assignment operator <-, e.g. sales <- 350
• We can also use -> or = (e.g. 350 -> sales), but these are used less
▪ Be mindful of directionality! -> or <- point towards the variable, not the value, and only variable =
value works (not value = variable)
• This does not provide any output, but R will process this internally
• We can, however, check by typing the name of the variable and running this code
- R lets us overwrite, meaning that assigning a new, different value to the previously set variable name will
erase the memory of the first value
- We can do calculations with variables, e.g. sales * royalty will result in the same output as multiplying their
values alone
- Disclaimer: you cannot use spaces in variable names

VECTORS
= a variable that can store multiple values
- To assign multiple values to a variable, we use the combine function c(), e.g. sales.by.month <- c(0, 100,
200, 50, 0, 0, 0, 0, 0, 0, 0, 0)
• This creates a single variable that is a vector containing a number of elements
• The combine function can also be used with vectors, e.g. sales.by.month.extended <- c(sales.by.month,
99)
- To extract information from a vector (e.g. the number of sales in the month of February), we use square
brackets [], e.g. sales.by.month[2] will result in an output of 100
• We can also use the square brackets to alter elements of a vector, e.g. sales.by.month[5] <- 25
• We can add negative indices to remove certain elements, e.g. sales.by.month[-(2:3)] OR
sales.by.month[-c(2,3)] removes elements 2 to 3 in a vector
• We can use the logical operator !=, e.g. salesbymonth[sales.by.month != 0] removes all 0 sales
- We can shorthand a continuous vector by using : , e.g. 2:8 is the same as c(2, 3, 4, 5, 7, 8)
• This can be used both for assigning elements to a vector, altering or extracting information from it
• When replacing information, be aware of the amount of numbers you want replaced and the amount
of numbers in your input, e.g. sales.by.month[1:3] <- c(9, 19) tells R to replace the first three numbers
but only provides two, resulting in an error
• But beware that R does have a recycling rule! E.g. sales.by.month[1:4] <- c(9, 19) WILL work as it uses
“9” as a replacement for both the 1st and 3rd value

, STAT3 – juni 2025 2


- When we multiply/add/subtract/divide/take powers of a vector by a single number, all elements in the
vector get multiplied/added/subtracted/divided/taken powers of
- To quickly find out how many elements a vector has, use the length() function

The recycling rule means that R “recycles” the value of the shorter vector several
times, e.g. when y has a length of 2, as compared to x with a length of 6, then the
third element of x is added to the first element of y again and so on
- This rule also applies for subtraction, multiplication and division
- If the length of the longer vector is not an exact multiple of the length of the
shorter one (e.g. 5 and 2), R will still do it but give us a warning

WARNINGS AND ERRORS
Both errors and warning signal something is off
- When R throws an error, R couldn’t do what we asked it to do, so it stopped, producing no output
- With a warning, it powered through and produced output, but it thinks something could be off, so we
should look at the code and the output with extra care

LOGICAL DATA
A logical value is an assertion about whether something is true or false
- We can test this using the equality operator ==, e.g. 2 + 2 == 4 → TRUE
• This is different from the assignment operator = !
- R will output either TRUE or FALSE
- We can also assign the value directly, e.g. is.it.correct <- TRUE
• We can even shortcut using T and F (but only in capitals)
- We can also both assign logical values in a vector as use the equality operator to extract logical values from
a vector
- It is possible to use logical values in numerical operations, where true will change to a value of 1 and false
to a value of 0

OTHER LOGICAL OPERATORS




In the or operator, at least one of the statements needs to be true for R to return a TRUE-value
$9.06
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Mellowerillish Katholieke Universiteit Leuven
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
160
Miembro desde
7 año
Número de seguidores
56
Documentos
40
Última venta
1 día hace

Ik bied samenvattingen aan van mijn vorige opleidingen (Kleuteronderwijs aan de UCLL in Heverlee, en verkort traject Toegepaste Psychologie aan de Thomas More in Antwerpen) en van mijn huidige opleiding (schakel/master Psychologie aan de KU Leuven). Hou er rekening mee dat leerstof kan variëren met de jaren en lectoren; mogelijks komen oudere samenvattingen niet helemaal meer overeen met jouw leerstof. Kijk goed de tags na als het gaat om een ouder bestand. Aarzel niet om me een berichtje te sturen met vragen, feedback of opmerkingen!

Lee mas Leer menos
4.4

12 reseñas

5
6
4
5
3
1
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes