Garantie de satisfaction à 100% Disponible immédiatement après paiement En ligne et en PDF Tu n'es attaché à rien 4,6 TrustPilot
logo-home
Resume

Summary Solutions Exercises R lab sessions

Note
-
Vendu
-
Pages
24
Publié le
22-12-2023
Écrit en
2023/2024

In this document you can find all the solutions of the lab sessions in R for Business Engineer second bachelor.











Oups ! Impossible de charger votre document. Réessayez ou contactez le support.

Infos sur le Document

Publié le
22 décembre 2023
Nombre de pages
24
Écrit en
2023/2024
Type
Resume

Sujets

Aperçu du contenu

Exercises: solutions: Introduction
Google is your best friend:

max(1,20,15,13,17,18,12,5)

2.3.1 Som van integers 1,…,100

100*(100+1)/2

2.3.2 Som van integers 1,…,1000

1000*(1000+1)/2

2.3.3 Interpreteer code

2

Functions

x <- c(5,6,1,2)

Geneste functies

log10(sqrt(100))

Variables in a dataframe

2

Variables names

# Load package and data

library(ISLR2)

data(Hitters)

names(Hitters)

# Use the function names to extract the variable names

Examining variables

# Load package and data

library(ISLR2)

data(Hitters)



# Use the accessor to extract Hits and assign it to the object a

a <- Hitters$Hits

# Determine the class of a

class(a)

Multiple ways to access variables

, # Load package and data

library(ISLR2)

data(Hitters)



# Use the accessor to extract Hits and assign it to a

a <- Hitters$Hits

# Use the square brackets to extract Hits and assign it to b

b <- Hitters[["Hits"]]

# Check if a and b are identical

identical(a,b)

Factors

# Load package and data

library(ISLR2)

data(Hitters)



# Determine the number of Leagues included in this variable

a <- Hitters$League

b <- levels(a)

length(b)

Tables

# Load package and data

library(ISLR2)

data(Hitters)

# Calculate the number of players per League using the table() function

table(Hitters$League)

Matrices 1

x <- matrix(c(7,8,5,3), 2, 2)

Matrices 2

x <- matrix(data= c(1,2,3,4), nrow =2, ncol = 2, byrow = TRUE)

Matrices 3

x <- matrix(data = c(1, 2, 3, 4), nrow = 2, ncol = 2)

, x.sqrt <- sqrt(x)

x.squared <- x^2

Indexing matrices 1

A <- matrix (1:16, 4, 4)

A1 <- A[1:3, 1:3]

A2 <- A[c(1,3),c(2,4)]

A3 <- A[2,4]

A4 <- A[,4]

A5 <- A[1,]+A[2,]

Indexing matrices 2

B <- matrix(1:8, 4, 2)

dim(B)

2.8.1-5. Vectoren

temp <- c(35,88,42,84,81,30)

city <- c("Beijing","Lagos","Paris","Rio de Janeiro","San Juan","Toronto")

named_temp <- temp

names(named_temp) <- city

temp_13 <- named_temp[1:3]

temp_ps <- named_temp[c("Paris","San Juan")]

2.8.6. Vector van getallen 12..73

12:73

Sequencing

x1 <- seq(5,10)

x2 <- seq(1,10, length = 4)

x3 <- seq(10,25,5)

2.8.7. Oneven getallen

seq(1,100,2)

Adding vectors and vector length

x <- c(1, 6, 2)

y <- c(1, 4, 3)

x.length <- length(x)
€6,19
Accéder à l'intégralité du document:

Garantie de satisfaction à 100%
Disponible immédiatement après paiement
En ligne et en PDF
Tu n'es attaché à rien

Faites connaissance avec le vendeur
Seller avatar
Worstje2021
5,0
(1)

Faites connaissance avec le vendeur

Seller avatar
Worstje2021 Universiteit Gent
Voir profil
S'abonner Vous devez être connecté afin de suivre les étudiants ou les cours
Vendu
7
Membre depuis
2 année
Nombre de followers
5
Documents
13
Dernière vente
1 année de cela

5,0

1 revues

5
1
4
0
3
0
2
0
1
0

Récemment consulté par vous

Pourquoi les étudiants choisissent Stuvia

Créé par d'autres étudiants, vérifié par les avis

Une qualité sur laquelle compter : rédigé par des étudiants qui ont réussi et évalué par d'autres qui ont utilisé ce document.

Le document ne convient pas ? Choisis un autre document

Aucun souci ! Tu peux sélectionner directement un autre document qui correspond mieux à ce que tu cherches.

Paye comme tu veux, apprends aussitôt

Aucun abonnement, aucun engagement. Paye selon tes habitudes par carte de crédit et télécharge ton document PDF instantanément.

Student with book image

“Acheté, téléchargé et réussi. C'est aussi simple que ça.”

Alisha Student

Foire aux questions