R Markdown

ES. 1: minutes in july?

31*24*60
## [1] 44640

ES. 2

senza usare il segno +

vector <- c(3,1,4,1,5,9,2,6)
sum(vector)
## [1] 31

ES. 3,4,5,6:

wizards <- c("Harry", "Ron", "Fred", "George", "Sirius", "Draco", "Albus")
ranking <- c(4,2,5,1,3,7,6)
wizards[2]
## [1] "Ron"
wizards[3] <- "Hermione"
wizards[4] <- "George"
wizards[5] <- "Sirius"

ES.7

Funzione Names()

daje roma

names(wizards) <- c("Protagonist", "Friend", "Friend", "Wife", "Professor", "Rival", "Headmaster")
wizards
## Protagonist      Friend      Friend        Wife   Professor       Rival 
##     "Harry"       "Ron"  "Hermione"    "George"    "Sirius"     "Draco" 
##  Headmaster 
##     "Albus"

ES. 8

ensomma

names(wizards)[6] <- "Ex-Rival"
wizards
## Protagonist      Friend      Friend        Wife   Professor    Ex-Rival 
##     "Harry"       "Ron"  "Hermione"    "George"    "Sirius"     "Draco" 
##  Headmaster 
##     "Albus"

ES.9