Throughout the world of data science, there are many languages and tools that can be used to complete a given task. While you are often able to use whichever tool you prefer, it is often important for analysts to work with similar platforms so that they can share their code with one another. Learning what professionals in the data science industry use while at work can help you gain a better understanding of things that you may be asked to do in the future.
In this project, we are going to find out what tools and languages professionals use in their day-to-day work. Our data comes from the Kaggle Data Science Survey which includes responses from over 10,000 people that write code to analyze data in their daily work.
# Load necessary packages
There were 16 warnings (use warnings() to see them)
library(tidyverse)
# Load the data
responses <- read_csv("kagglesurvey.csv")
Parsed with column specification:
cols(
Respondent = [32mcol_double()[39m,
WorkToolsSelect = [31mcol_character()[39m,
LanguageRecommendationSelect = [31mcol_character()[39m,
EmployerIndustry = [31mcol_character()[39m,
WorkAlgorithmsSelect = [31mcol_character()[39m
)
# Print the first 10 rows
head(responses, 10)
Now that we have loaded in the survey results, we want to focus on the tools and languages that the survey respondents use at work.
To get a better idea of how the data are formatted, we will look at the first respondent’s tool-use and see that this survey-taker listed multiple tools that are each separated by a comma. To learn how many people use each tool, we need to separate out all of the tools used by each individual. There are several ways to complete this task, but we will use str_split() from stringr to separate the tools at each comma. Since that will create a list inside of the data frame, we can use the tidyr function unnest() to separate each list item into a new row.
# Print the first respondent's tools and languages
responses$WorkToolsSelect[1]
[1] "Amazon Web services,Oracle Data Mining/ Oracle R Enterprise,Perl"
# Add a new column, and unnest the new column
tools <- responses %>%
mutate(work_tools = str_split(WorkToolsSelect, ",")) %>%
unnest(cols = c(work_tools))
# View the first 6 rows of tools
head(tools)
Now that we’ve split apart all of the tools used by each respondent, we can figure out which tools are the most popular.
# Group the data by work_tools, summarise the counts, and arrange in descending order
tool_count <- tools %>%
group_by(work_tools) %>%
summarise(n = n()) %>%
arrange(desc(n)) %>%
filter(!is.na(work_tools))
`summarise()` ungrouping output (override with `.groups` argument)
# Print the first 6 results.
head(tool_count)
Let’s see how the most popular tools stack up against the rest.
#lets list the fist 10
tool_top <- head(tool_count, 20)
# Create a bar chart of the work_tools column, most counts on the far right
ggplot(tool_top, aes(x = fct_reorder(work_tools, n), y = n)) +
geom_bar(stat = "identity") +
coord_flip()
#theme(axis.text.x = element_text(angle=90, vjust=0.5, hjust= 1))
Within the field of data science, there is a lot of debate among professionals about whether R or Python should reign supreme. You can see from our last figure that R and Python are the two most commonly used languages, but it’s possible that many respondents use both R and Python. Let’s take a look at how many people use R, Python, and both tools.
# Create a new column called language preference
debate_tools <- responses %>%
mutate(language_preference = case_when(
str_detect(WorkToolsSelect, "R") & !str_detect(WorkToolsSelect, "Python") ~ "R",
str_detect(WorkToolsSelect, "Python") & !str_detect(WorkToolsSelect, "R") ~ "Python",
str_detect(WorkToolsSelect, "R") & str_detect(WorkToolsSelect, "Python") ~ "both",
TRUE ~ "neither"
))
# Print the first 6 rows
head(debate_tools)
Now we just need to take a closer look at how many respondents use R, Python, and both!
# Group by language preference, calculate number of responses, and remove "neither"
debate_plot <- debate_tools %>%
group_by(language_preference) %>%
summarise(count = n()) %>%
filter(language_preference != "neither")
`summarise()` ungrouping output (override with `.groups` argument)
# Create a bar chart
ggplot(debate_plot, aes(x = language_preference, y = count)) +
geom_col()
It looks like the largest group of professionals program in both Python and R. But what happens when they are asked which language they recommend to new learners? Do R lovers always recommend R?
# Group by, summarise, arrange, mutate, and filter
recommendations <- debate_tools %>%
group_by(language_preference, LanguageRecommendationSelect) %>%
summarise(count = n()) %>%
arrange(language_preference, desc(count)) %>%
mutate(row = row_number(language_preference)) %>%
filter(row <= 4)
`summarise()` regrouping output by 'language_preference' (override with `.groups` argument)
Just one thing left. Let’s graphically determine which languages are most recommended based on the language that a person uses.
# Create a faceted bar plot
ggplot(recommendations, aes(x = LanguageRecommendationSelect, y = count)) +
geom_bar(stat = "identity") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1)) +
facet_wrap(~language_preference)
So we’ve made it to the end. We’ve found that Python is the most popular language used among Kaggle data scientists, but R users aren’t far behind. And while Python users may highly recommend that new learners learn Python