As in the presentation, we will use
stackoverflow_survey_single_response.csv. You should
(have) download(ed) the dataset or find it in a folder called
data within the folder containing the materials for this
workshop.
library (tidyverse)
library (haven)
library(sjlabelled)
library(readr)
stackoverflow_survey_single_response <- read_csv("./data/stackoverflow_survey_single_response.csv")
Using base R, create a new object called
user_background that contains all variables that assess the
respondent characteristics (like age, education, years of coding
experience).
main_branch, and the last one is
years_code_pro. They appear consecutively in the data set.
Remember that there are two options for selecting columns in
base R: One is subsetting using [ ], the other is the
subset() function.
tidyverse package
dplyr, select only the character variables from the
stackoverflow_survey_single_response data and assign them
to an object named tuesdata_char.
where() for this task.
After creating subsets of variables, let’s now rename those variables
using dplyr functions again for the
tuesdata_person object in one step.
select() command.