| Salary | Profession | Region |
| 126411 | Data Scientist | San Francisco |
| 108402 | Data Scientist | San Francisco |
| 99399 | Data Scientist | San Francisco |
| 91381 | Data Scientist | San Francisco |
| 105023 | Data Scientist | San Francisco |
| 108944 | Data Scientist | San Francisco |
| 123952 | Data Scientist | San Francisco |
| 108217 | Data Scientist | San Francisco |
| 103722 | Data Scientist | San Francisco |
| 140179 | Data Scientist | San Francisco |
| 116892 | Data Scientist | San Francisco |
| 118661 | Data Scientist | San Francisco |
| 116750 | Data Scientist | San Francisco |
| 132715 | Data Scientist | San Francisco |
| 139308 | Data Scientist | San Francisco |
| 104449 | Data Scientist | San Francisco |
| 126215 | Data Scientist | San Francisco |
| 90123 | Data Scientist | San Francisco |
| 101061 | Data Scientist | San Francisco |
| 116180 | Data Scientist | San Francisco |
| 105797 | Data Scientist | Seattle |
| 118749 | Data Scientist | Seattle |
| 118746 | Data Scientist | Seattle |
| 108190 | Data Scientist | Seattle |
| 104155 | Data Scientist | Seattle |
| 95080 | Data Scientist | Seattle |
| 97195 | Data Scientist | Seattle |
| 138768 | Data Scientist | Seattle |
| 118002 | Data Scientist | Seattle |
| 133437 | Data Scientist | Seattle |
| 101295 | Data Scientist | Seattle |
| 102315 | Data Scientist | Seattle |
| 111078 | Data Scientist | Seattle |
| 127669 | Data Scientist | Seattle |
| 103572 | Data Scientist | Seattle |
| 97341 | Data Scientist | Seattle |
| 118923 | Data Scientist | Seattle |
| 132107 | Data Scientist | Seattle |
| 110472 | Data Scientist | Seattle |
| 107652 | Data Scientist | Seattle |
| 75961 | Data Scientist | New York |
| 75484 | Data Scientist | New York |
| 116494 | Data Scientist | New York |
| 99164 | Data Scientist | New York |
| 76060 | Data Scientist | New York |
| 116566 | Data Scientist | New York |
| 77178 | Data Scientist | New York |
| 87296 | Data Scientist | New York |
| 100507 | Data Scientist | New York |
| 107007 | Data Scientist | New York |
| 79650 | Data Scientist | New York |
| 81800 | Data Scientist | New York |
| 105345 | Data Scientist | New York |
| 87041 | Data Scientist | New York |
| 128634 | Data Scientist | New York |
| 84921 | Data Scientist | New York |
| 91344 | Data Scientist | New York |
| 72773 | Data Scientist | New York |
| 96815 | Data Scientist | New York |
| 92188 | Data Scientist | New York |
| 92005 | Software Engineer | San Francisco |
| 99327 | Software Engineer | San Francisco |
| 126611 | Software Engineer | San Francisco |
| 94824 | Software Engineer | San Francisco |
| 96105 | Software Engineer | San Francisco |
| 101344 | Software Engineer | San Francisco |
| 109704 | Software Engineer | San Francisco |
| 103746 | Software Engineer | San Francisco |
| 116336 | Software Engineer | San Francisco |
| 102952 | Software Engineer | San Francisco |
| 89386 | Software Engineer | San Francisco |
| 111197 | Software Engineer | San Francisco |
| 114578 | Software Engineer | San Francisco |
| 98308 | Software Engineer | San Francisco |
| 113778 | Software Engineer | San Francisco |
| 118666 | Software Engineer | San Francisco |
| 116163 | Software Engineer | San Francisco |
| 106534 | Software Engineer | San Francisco |
| 92132 | Software Engineer | San Francisco |
| 105606 | Software Engineer | San Francisco |
| 94281 | Software Engineer | Seattle |
| 101006 | Software Engineer | Seattle |
| 87344 | Software Engineer | Seattle |
| 107018 | Software Engineer | Seattle |
| 104480 | Software Engineer | Seattle |
| 89333 | Software Engineer | Seattle |
| 103167 | Software Engineer | Seattle |
| 78263 | Software Engineer | Seattle |
| 90935 | Software Engineer | Seattle |
| 87181 | Software Engineer | Seattle |
| 90052 | Software Engineer | Seattle |
| 109727 | Software Engineer | Seattle |
| 74991 | Software Engineer | Seattle |
| 84309 | Software Engineer | Seattle |
| 95323 | Software Engineer | Seattle |
| 102464 | Software Engineer | Seattle |
| 84341 | Software Engineer | Seattle |
| 95533 | Software Engineer | Seattle |
| 116071 | Software Engineer | Seattle |
| 115156 | Software Engineer | Seattle |
| 96868 | Software Engineer | New York |
| 88012 | Software Engineer | New York |
| 110653 | Software Engineer | New York |
| 85931 | Software Engineer | New York |
| 79505 | Software Engineer | New York |
| 72723 | Software Engineer | New York |
| 92517 | Software Engineer | New York |
| 106335 | Software Engineer | New York |
| 92380 | Software Engineer | New York |
| 87724 | Software Engineer | New York |
| 93080 | Software Engineer | New York |
| 85412 | Software Engineer | New York |
| 95040 | Software Engineer | New York |
| 90367 | Software Engineer | New York |
| 81026 | Software Engineer | New York |
| 102894 | Software Engineer | New York |
| 94194 | Software Engineer | New York |
| 107241 | Software Engineer | New York |
| 88650 | Software Engineer | New York |
| 80039 | Software Engineer | New York |
| 78898 | BI Engineer | San Francisco |
| 79420 | BI Engineer | San Francisco |
| 89388 | BI Engineer | San Francisco |
| 69050 | BI Engineer | San Francisco |
| 81554 | BI Engineer | San Francisco |
| 67235 | BI Engineer | San Francisco |
| 67062 | BI Engineer | San Francisco |
| 71902 | BI Engineer | San Francisco |
| 93594 | BI Engineer | San Francisco |
| 96299 | BI Engineer | San Francisco |
| 75614 | BI Engineer | San Francisco |
| 76899 | BI Engineer | San Francisco |
| 95617 | BI Engineer | San Francisco |
| 88354 | BI Engineer | San Francisco |
| 63640 | BI Engineer | San Francisco |
| 68403 | BI Engineer | San Francisco |
| 78709 | BI Engineer | San Francisco |
| 80797 | BI Engineer | San Francisco |
| 75026 | BI Engineer | San Francisco |
| 81341 | BI Engineer | San Francisco |
| 81048 | BI Engineer | Seattle |
| 73819 | BI Engineer | Seattle |
| 87117 | BI Engineer | Seattle |
| 80532 | BI Engineer | Seattle |
| 83890 | BI Engineer | Seattle |
| 90094 | BI Engineer | Seattle |
| 77243 | BI Engineer | Seattle |
| 57646 | BI Engineer | Seattle |
| 84029 | BI Engineer | Seattle |
| 84038 | BI Engineer | Seattle |
| 81495 | BI Engineer | Seattle |
| 75725 | BI Engineer | Seattle |
| 77256 | BI Engineer | Seattle |
| 87649 | BI Engineer | Seattle |
| 67000 | BI Engineer | Seattle |
| 74265 | BI Engineer | Seattle |
| 80667 | BI Engineer | Seattle |
| 86757 | BI Engineer | Seattle |
| 68724 | BI Engineer | Seattle |
| 96103 | BI Engineer | Seattle |
| 78386 | BI Engineer | New York |
| 102688 | BI Engineer | New York |
| 99283 | BI Engineer | New York |
| 85439 | BI Engineer | New York |
| 71795 | BI Engineer | New York |
| 73199 | BI Engineer | New York |
| 72208 | BI Engineer | New York |
| 77969 | BI Engineer | New York |
| 64237 | BI Engineer | New York |
| 85848 | BI Engineer | New York |
| 65401 | BI Engineer | New York |
| 70327 | BI Engineer | New York |
| 79493 | BI Engineer | New York |
| 73740 | BI Engineer | New York |
| 65560 | BI Engineer | New York |
| 72536 | BI Engineer | New York |
| 69523 | BI Engineer | New York |
| 72989 | BI Engineer | New York |
| 89069 | BI Engineer | New York |
| 80685 | BI Engineer | New York |
Importing the dataset to R as a .csv file
>sbr<- read.csv("salary_by_region.csv")
>head(sbr)
## Salary Profession Region
## 1 126411 Data Scientist San Francisco
## 2 108402 Data Scientist San Francisco
## 3 99399 Data Scientist San Francisco
## 4 91381 Data Scientist San Francisco
## 5 105023 Data Scientist San Francisco
## 6 108944 Data Scientist San Francisco
#Min Salary by Profession
>library('data.table')
>Profession_DT<- as.data.table(sbr)
>Profession_DT[, min(Salary),
by= Profession]
## Profession V1
## 1: Data Scientist 72773
## 2: Software Engineer 72723
## 3: BI Engineer 57646
#Max Salary by Profession
Profession_DT [, max(Salary), by= Profession]
## Profession V1
## 1: Data Scientist 140179
## 2: Software Engineer 126611
## 3: BI Engineer 102688
#Min Salary by Region
Profession_DT [, min(Salary), by= Region]
## Region V1
## 1: San Francisco 63640
## 2: Seattle 57646
## 3: New York 64237
#Max Salary by Region
Profession_DT [, max(Salary), by= Region]
## Region V1
## 1: San Francisco 140179
## 2: Seattle 138768
## 3: New York 128634
I converted the two categorical variables (Profession and Region) to factors.
>sbr$Profession <-as.factor(sbr$Profession)
>str(sbr$Profession)
Factor w/ 3 levels "New York","San Francisco",..: 2 2 2 2 2 2 2 2 2 2 ...
>sbr$Region<-as.factor(sbr$Region)
>str(sbr$Region)
Factor w/ 3 levels "New York","San Francisco",..: 2 2 2 2 2 2 2 2 2 2 ...
I created two boxplots of the variables to visually explore the data. The first plot is a boxplot of the Salaries of the three different professions by region while the second plot shows the three professions by their salaries alone.
>install.packages('ggpubr')
>library("ggpubr")
plot_s<-ggboxplot( sbr, x = "Profession", y = "Salary", color = "Region",
palette = c("#00AFBB", "#E7B800","#FC4E07" ))
plot_s +geom_jitter(color="Gray")+ ggtitle("Boxplot of Salary by Profession in 3 Regions")

As can be seen from the above plot, the Data scientist group appears to be the highest paid of all three professions in all three regions followed by the Software Engineer group. New York is the least paying of all three professions.
sb<- ggplot(data=sbr,aes(x = Profession, y=Salary, color=Profession))
sb + geom_jitter() +geom_boxplot() +geom_point()+
ggtitle("Boxplot of Salary by Profession")

The boxplot shows that the overall median salary as well as the upper and lower quartiles of the Data Scientist group are the highest of all three professions, followed by that of the Software Engineer group.
I plotted a histogram to check for normality.
normality<-ggplot(data=sbr, aes( x=Salary))
normality+geom_histogram(binwidth = 5000,aes (fill=Region), color="Black")
