Completion requirements
This section introduces the functionality of the base-R function boxplot. Note that for some data formats, the plot function with x being a factor variable will also work.
Preliminary tasks
-
Launch RStudio as described here: Running RStudio and setting up your working directory
-
Prepare your data as described here: Best practices for preparing your data and save it in an external .txt tab or .csv files
-
Import your data into R as described here: Fast reading of data from txt|csv files into R: readr package.
Here, we'll use the R built-in ToothGrowth data set.
# Print the first 6 rows head(ToothGrowth, 6)
## len supp dose ## 1 4.2 VC 0.5 ## 2 11.5 VC 0.5 ## 3 7.3 VC 0.5 ## 4 5.8 VC 0.5 ## 5 6.4 VC 0.5 ## 6 10.0 VC 0.5
Source: STHDA, http://www.sthda.com/english/wiki/box-plots-r-base-graphs This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.