library(readxl)
library(writexl)
library(quanteda)
library(lattice)
library(tidyverse)
library(crosstable)
library(flextable)
library(confintr)1.5 Libraries
Recommended reading
Winter (2020): Chapter 1.13
Working with packages in R
Packages expand the basic functionality of R by providing numerous quality-of-life improvements that not only considerably simplify common data-wrangling tasks but also provide frameworks for state-of-the-art methods of statistical analysis and natural language processing (NLP), among many other things.
Installation
In RStudio, navigate to Packages > Install and verify that the pop-up window says Install from: Repository (CRAN). You can now enter the name of the package you would like to install in the Packages field.
Loading packages
Once the installation is complete, you can load the packages using the code below. You can ignore any warning messages that appear.
Whenever you start a new R session (i.e., open RStudio), your packages and their functions will be inactive. To reactivate a package, either use the library() function or simply tick its box in the Packages tab.
It is good practice to activate only those packages that are necessary for your analysis. While this is not a problem for the small set of packages shown here, loading dozens of packages increases the risk of ending up with ‘homonymous’ functions, i.e., functions that have the same name but perform different operations. In such cases, it can be helpful to ‘disambiguate’ them by explicitly indicating which package a function comes from:
readxl::read_xlsx(...)Citing R and R packages
Whenever we draw on ideas other than our own, we give credit to the respective source by citing it appropriately. The same applies to R, RStudio and all the packages we rely on in our analyses.
For R, an up-to-date citation can be generated as follows:
citation()To cite R in publications use:
R Core Team (2024). _R: A Language and Environment for Statistical
Computing_. R Foundation for Statistical Computing, Vienna, Austria.
<https://www.R-project.org/>.
A BibTeX entry for LaTeX users is
@Manual{,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2024},
url = {https://www.R-project.org/},
}
We have invested a lot of time and effort in creating R, please cite it
when using it for data analysis. See also 'citation("pkgname")' for
citing R packages.
To cite a specific package, simply supply its name as an argument to citation():
citation("quanteda")To cite package 'quanteda' in publications use:
Benoit K, Watanabe K, Wang H, Nulty P, Obeng A, Müller S, Matsuo A
(2018). "quanteda: An R package for the quantitative analysis of
textual data." _Journal of Open Source Software_, *3*(30), 774.
doi:10.21105/joss.00774 <https://doi.org/10.21105/joss.00774>,
<https://quanteda.io>.
A BibTeX entry for LaTeX users is
@Article{,
title = {quanteda: An R package for the quantitative analysis of textual data},
journal = {Journal of Open Source Software},
author = {Kenneth Benoit and Kohei Watanabe and Haiyan Wang and Paul Nulty and Adam Obeng and Stefan Müller and Akitaka Matsuo},
doi = {10.21105/joss.00774},
url = {https://quanteda.io},
volume = {3},
number = {30},
pages = {774},
year = {2018},
}