Let’s take a trip to a Statisticians Paradise, otherwise known as Vegas!
Thanks to R and your new data analytical skills, you will learn how to uplift your performance at the tables and make some profits. After this tutorial, you will be able to easily track your betting progress and analyze your past action.
Create a Vector
Vectors are one-dimensional arrays that can store numeric data, character data, or logical data. They are a simple tool to store data. For example, you can store your daily gains and losses in the casinos.
In R, you create a vector with the combine function [**c()**](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/c)
.You place the vector elements separated by a comma between the parentheses. For example:
numeric_vector <- c(1, 2, 3)
character_vector <- c("a", "b", "c")
Once you have created these vectors in R, you can use them to do calculations.
Create a vector that contains the three elements: TRUE
, FALSE
, and TRUE
(in that order)
boolean_vector <- c(TRUE, FALSE, TRUE)
After a week in Vegas, you still aren’t rolling in dough. So, you decide to start using your new data analysis skills.
Before doing an analysis first, you decide to collect the outcomes for the last week:
For Poker:
For Roulette:
You only played poker and roulette. Assign the winnings/losses to variables.
# Poker winnings from Monday to Friday
poker_vector <- c(140, -50, 20, -120, 240)
# Roulette winnings from Monday to Friday
roulette_vector <- c(-24, -50, 100, -350, 10)
#data-sceince #r #data-analytics-tools #data-analytics #data-analysis #data analysis