Imagine someone flips a coin 100 times.
You gain a dollar every time the coin comes up heads, and you lose a dollar every time it comes up tails.
You start off with $50, and you want to keep track of your money over time.
So you decide to create a plot showing how much money you have over time.
Can you use R to simulate this situation? (the plot and all)
This question can be done succinctly using the following commands, but complete it however you see fit:
runif() or sample(), ifelse(), cumsum(), plot()
Your plot should look something like like this (although the data will be different every time)
Make this graph twice, once using plot() and once using ggplot.
Research the following dplyr “verbs” and give brief explanations for each.
selectgroup_bysummarizemutatearrangefilter inner_join and outer_join
First describe what “join” does and then describe the difference between inner joins & outer joins.
Download the mcd.tsv file from the website and put it into the directory you’ve been using throughout this seminar. Run the following command to load the data into R.
mcd <- read.delim("mcd.tsv",header=TRUE,sep = "\t")
qplot(CAL,data=mcd)qplot(CAL,SGR,data=mcd)qplot(CAL,SGR,color=CATEGORY,data=mcd) Download the nba.csv file from the website and load it into R. a) Using the NBA dataset provided, use dplyr to find the player with the highest total fouls. b) Find the average amount of points scored each season by player. c) Create a table that shows the top scoring player for each season. d) What player(s) was the top scorer for the most seasons?
flights to find the average distance flown by carrier Use both the flights and planes data table to answer this. Create a table with two columns: mean distance flown and number of seats. This table will be grouped by seat.