knitr::opts_chunk$set(echo = TRUE)
$\$
library(fivethirtyeight) # get the 70th percentile of the Bechdel data quantile(bechdel$domgross_2013, .7, na.rm = TRUE)
$\$
# get pass fail data separately bechdel_pass_df <- subset(bechdel, binary == "PASS") bechdel_fail_df <- subset(bechdel, binary == "FAIL") domgross_pass <- bechdel_pass_df$domgross_2013 domgross_fail <- bechdel_fail_df$domgross_2013 # boxplot boxplot(domgross_pass, domgross_fail, names = c("pass", "fail")) # log 10 of the data boxplot boxplot(log10(domgross_pass), log10(domgross_fail), names = c("pass", "fail"))
$\$
# original data budget <- bechdel$budget_2013 profit <- bechdel$domgross_2013 # create scatter plot plot(budget, profit) # add identity line abline(a = 0, b = 1, col = "red") # calculate the correlation cor(budget, profit, use = "complete.obs") # look at log10 of the data scatter plot budget_log10 <- log10(budget) profit_log10 <- log10(profit) # create scatter plot plot(budget_log10, profit_log10) # add identity line abline(a = 0, b = 1, col = "red") # calculate the correlation cor(budget_log10, profit_log10, use = "complete.obs")
$\$
library(Lock5Data) # get the data from the data frame years_played <- FootballBrain$Years hippocampus_vol <- FootballBrain$Hipp group <- FootballBrain$Group # create scatterplot and calculate the correlation plot(years_played, hippocampus_vol) cor(years_played, hippocampus_vol) # create side-by-side boxplots for the different groups boxplot(hippocampus_vol ~ group)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.