Advanced selection
Just like you did for poker, you also want to know those days where you realized a positive return for roulette.
This exercise is part of the course
Introduction to R
Exercise instructions
- Create the variable
selection_vector
, this time to see if you made profit with roulette for different days. - Assign the amounts that you made on the days that you ended positively for roulette to the variable
roulette_winning_days
. This vector thus contains the positive winnings ofroulette_vector
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Poker and roulette winnings from Monday to Friday:
poker_vector <- c(140, -50, 20, -120, 240)
roulette_vector <- c(-24, -50, 100, -350, 10)
days_vector <- c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday")
names(poker_vector) <- days_vector
names(roulette_vector) <- days_vector
# Which days did you make money on roulette?
selection_vector <-
# Select from roulette_vector these days
roulette_winning_days <-