Lab3DV

Running Code

library(datasetsICR)
library(ggplot2)
data(FIFA)

#Create a table for the factor (categorical) variable assigned to you from the dataset


#wages to numeric
FIFA$Wage <- as.numeric(FIFA$Wage)


fifarm <- FIFA[FIFA$Club == "Real Madrid", ]

#fifarm

table(fifarm$Preferred.Foot)

       Left Right 
    0     6    27 
p <- ggplot(fifarm, aes(x = Penalties, y = Wage, color = Preferred.Foot)) +
  geom_point() +
  labs(x = "Penalties", y = "Wages", title = "Penalties and Wages", subtitle = "The data shows a 'mostly' postive relationship between penalties and wages.", caption = "Source for info: https://www.kaggle.com/karangadiya/fifa19") +
  theme_minimal() + scale_color_manual(values = c("Left" = "blue", "Right" = "red"), name = "Preferred Foot")

p

# Saveing
ggsave(filename = "Lab3DV.png", plot = p)
Saving 7 x 5 in image

Results

For your final chart, interpret the findings from the chart in text. Full sentences required. Render your chart as a revealjs presentation. Publish to RPubs. (Also did table in instructions with 27 Right and 6 Left)

Results: This chart shows the relationship between Penalties and Wages with the preferred foot as a color. The relationship is mostly positive, and most of them are right footed. Still, some low wages still get lots of penalties sometimes.