Get startedGet started for free

Create a vector (3)

After one week in Las Vegas and still zero Ferraris in your garage, you decide that it is time to start using your data analytical superpowers.

Before doing a first analysis, you decide to first collect all the winnings and losses for the last week:

For poker_vector:

  • On Monday you won $140
  • Tuesday you lost $50
  • Wednesday you won $20
  • Thursday you lost $120
  • Friday you won $240

For roulette_vector:

  • On Monday you lost $24
  • Tuesday you lost $50
  • Wednesday you won $100
  • Thursday you lost $350
  • Friday you won $10

You only played poker and roulette, since there was a delegation of mediums that occupied the craps tables. To be able to use this data in R, you decide to create the variables poker_vector and roulette_vector.

This exercise is part of the course

Introduction to R

View Course

Exercise instructions

Assign the winnings/losses for roulette to the variable roulette_vector. You lost $24, then lost $50, won $100, lost $350, and won $10.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Poker winnings from Monday to Friday
poker_vector <- c(140, -50, 20, -120, 240)

# Roulette winnings from Monday to Friday
roulette_vector <-  
Edit and Run Code