Task 1. Read the “Professorial Salaries” and name this dataset “salary”

salary = read.csv("C:\\Users\\12884742\\Downloads\\Professorial Salaries.csv")
library(ggplot2)

Task 2. Distribution of numeric data

2a. Create a graph to describe the distribution of professors’ salaries. Are professors’ salaries normally distributed?

The data is postively skewed, and thereby not normally distributed

p = ggplot(data=salary, aes(x=Salary)) + geom_histogram()
p
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

2b. Create a graph to describe the differences in salaries between male and female professors. Were the professors’ salaries different between male and female professors?

Incredibly so, the salaries for female professors is notably lower across the board than for their male counterparts

p = ggplot(data=salary, aes(x=Salary, colour=Sex)) + geom_histogram(fill="white", alpha=0.5, position="identity")
p
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Task 3. Distribution of categorical data

3a. Create a graph to describe the distribution of professors’ rank. Write a sentence to interpret the graph.

There is over triple the amount of ‘Professors’ as either ‘Assistant Professors’ or ‘Associate Professors’

p = ggplot(data=salary, aes(x=Rank)) + geom_bar()
p

3b. Create a graph to describe whether professors’ ranks differed between male and female professors. Write a sentence to interpret the graph.

While the general trend of there being more ‘Professors’ remains the same, there is a notably lower ratio for females than males

p = ggplot(data=salary, aes(x=Rank, fill=Sex)) + geom_bar(position = position_dodge())
p

Task 4. Comparison of numeric data

4a. Create a graph to describe the differences in salaries between male and female professors. What are the differences between the graphs 2b and 4a?

As a boxplot, graph 4a shows a much clearer depiction of the range and spread of salaries across genders, interestingly the averages are relatively close together, even though the spread skews male.

p = ggplot(data = salary, aes(x = Salary, y = Sex)) + geom_boxplot()
p

4b. Create a graph to describe the differences in salaries by professors’ rank and sex. What do you think about the graph?

This graph showcases that there is a great deal of variability in Q1/Q4 of each rank, but the averages are remarkably similar

p = ggplot(data=salary, aes(x=Salary, y=Sex, fill=Rank)) + geom_boxplot()
p

Task 5. Correlation between numeric data

5a. Create a graph to describe the correlation between professors’ salaries and their time in service. How were professors’ salaries correlated with their time in service?

Generally, increased time working for the group increased the person’s salary, though it is notably not a continuous linear increase, nor are increases always the case.

p = ggplot(data=salary, aes(x=Yrs.service, y=Salary)) + geom_point()
p

5b. Create a graph to describe whether the correlation between professors’ salaries and their time in service differed between male and female professors. Write a sentence to interpret the graph.

There doesn’t appear to be any difference in the time in service vs salary increases across gender.

p = ggplot(data=salary, aes(x=Yrs.service, y=Salary, fill=Sex, colour=Sex)) + geom_point()
p

Task 6. Save your works and upload them to your own Rpubs account.

Hey look at that, you’re reading it again!