R for Social Scientists
- Use RStudio to write and run R programs.
install.packages() to install packages
- Access individual values by location using
- Access arbitrary sets of data using
- Use logical operations and logical vectors to access subsets of
- Use read_csv to read tabular data in R.
- Use factors to represent categorical data in R.
- Use the
dplyr package to manipulate dataframes.
select() to choose variables from a dataframe.
filter() to choose data based on values.
summarize() to work
with subsets of data.
mutate() to create new variables.
- Use the
tidyr package to change the layout of
pivot_wider() to go from long to wide format.
pivot_longer() to go from wide to long format.
ggplot2 is a flexible and useful tool for creating
plots in R.
- The data set and coordinate system can be defined using the
- Additional layers, including geoms, are added using the
- Boxplots are useful for visualizing the distribution of a continuous
- Barplots are useful for visualizing categorical data.
- Faceting allows you to generate multiple plots based on a
- R Markdown is a useful language for creating reproducible documents
combining text and executable R-code.
- Specify chunk options to control formatting of the output
- JSON is a popular data format for transferring data used by a great
many Web based APIs
- The complex structure of a JSON document means that it cannot easily
be ‘flattened’ into tabular data
- We can use R code to extract values of interest and place them in a