Boxplots and Grouped Boxplots in R: How to Create and Modify Boxplots and Group Boxplots (Side By Side Box plots) with R; Link to Free Dataset: ( Box plots Explained in this video: ( 👍🏼Best Statistics & R Programming Tutorials: ( )
►► Like to support us? You can Donate ( Share our Videos, Leave us a Comment and Give us a Thumbs up! Either way We Thank You!
In this R video tutorial, we will learn how to produce box plots (a.k.a. box and whisker diagram) in R, as well as “side by side boxplots” for multiple groups (i.e. boxplots with groups) with examples. In this R tutorial we will also learn how to add titles, change axes labels, and many other modifications to the plot by using “boxplot”, “~”, “ylim”, and “quantile” functions and “xlab”, “ylab”, “ylim”, “las” arguments.
► ►You can access and download the “LungCapData” dataset here:
◼︎ Table of Content:
► 0:00:05 what is a box plot and when should we use it
► 0:00:25 how to produce a “box plot” in R? By using “box.plot” function
► 0:00:30 how to access the help menu in R
► 0:00:56 how to report the “minimum”, “first quartile”, “median”, “third quartile”, and “maximum” in a “box plot” in R? By using the “quantile” function
► ► Modifying Box Plots in R
► 0:01:31 how to add a title to a boxplot in R using the “main” argument
► 0:01:39 how to label the x-axis or the y-axis of a “box plot” using “xlab” or “ylab” arguments
► 0:01:52 how to change the limits for the y-axis of a “box plot” in R using the “ylim” argument
► 0:02:04 how to rotate the values on the y-axis of a “box plot” using “las” argument
► 0:02:13 how to produce side-by-side box plots in R using “boxplot” and “~” (separate) functions (for example: when comparing the distribution of a numeric variable for different groups that are formed by a categorical variable)
► 0:02:53 how to add a title to side-by-side boxplots in R using the “main” argument
► 0:03:04 how to produce side-by-side box plots in R using the “square brackets” to subset data
► 0:03:35 double equal sign (==) , what does this mean?
These video tutorials are useful for anyone interested in learning data science and statistics with R programming language using RStudio.
►► Watch More:
► Intro to Statistics Course:
►R Tutorials for Data Science
►Getting Started with R (Series 1):
►Graphs and Descriptive Statistics in R (Series 2):
►Probability distributions in R (Series 3):
►Bivariate analysis in R (Series 4):
►Linear Regression in R (Series 5):
►ANOVA Concept and with R
►Linear Regression Concept and with R
Follow MarinStatsLectures
Subscribe:
website:
Facebook:
Twitter:
Instagram:
Our Team:
Content Creator: Mike Marin (B.Sc., MSc.) Senior Instructor at UBC.
Producer and Creative Manager: Ladan Hamadani (B.Sc., BA., MPH)
These videos are created by #marinstatslectures to support some courses at The University of British Columbia (UBC) (#IntroductoryStatistics and #RVideoTutorials for Health Science Research), although we make all videos available to the everyone everywhere for free.
Thanks for watching! Have fun and remember that statistics is almost as beautiful as a unicorn!
source

In this R video tutorial you will learn how to produce box plots (or box and whisker diagram), as well as "side by side boxplots" for multiple groups (i.e. boxplots with groups) in R. Here we will learn how to add titles, change axes labels, and many other modifications to the plot by using different functions and arguments In R. Like to support us? You can Donate https://statslectures.com/support-us or Share the Videos. Make sure to donwload the Free LungCapData here for Practice : ( https://bit.ly/2rOfgEJ )
the link doesnt work for downloading the files
how do i then group these boxplots after theyve been grouped
great video! learnt this concept in an easy way
thanks i finally found a video that helps with what i needed
bro i love u
Hi,
dim(Gender)
NULL
How to rectify this? My dimensions shows null allways. Why is That?
Thank you so much 🙂
THANKSSSSSSSSSSSSSSSSSSSSSSS!!!!!
Sir…. How can we add legend to this
I need to make 2 box plots. 1 with systolic blood pressure for obesity, 1 for systolic blood pressure without obesity. I have no idea how to determine obesity with bmi of 30 or more. HELP ME
Is there any difference between this and the ggplot2 usage of geom_boxplot()?
Thanks!
Thank you, so helpful and very easy to understand!
I did not know what a tilde operator (~) was in R. It made me lose 2 hours trying to understand what was wrong. The help file for this function does not explain it!!! R is the most infuriating language I have encountered.
Great video. Thanks a lot!
🤘👍👍
Great tutorial video. Thank you.
Question: I am to create boxplot from log10 of my dataset using ggplot in R. Log10 values of my data contains -ve and +ve infinitive values. In addition, 1st quartilex, min and median for some variables show infinitive values after log-transformation. But on the boxplot only 0-3 values can be seen. What about the infinitives?
Really great video, thank you so much! I was wondering if there is a way to add the mean value of the data to the boxplot, for example as a black 'X' ?
Dude, this was fucking ace.
`las = 1` should be default. lol
I have 45 categories can I use box plot
Thank you so much!
Its really very helpful.
Sir,your tutorials are amazing
Great video!
Excellent video! Thank you very much!
Your videos are comprehensive. they are great. thanks^100000000000.
How would you add a caption to the figure?
Hi
how do you change the quantiles displayed on the boxplot? For example, I want a boxplot displaying the percentiles 10 to 90th. Is this possible?
Hey,
I am strictly following your instruction which I find genial, yet I have the following problem this time. It seem to be unsolvable for me:
1) I write down the command line as follows in your video:
> LungCapData <- read.table(file.choose(), header = T, sep = "t")
Then I choose the txt file from my Mac (LungCapData).
When I write the attach command, I get this notification
> attach(LungCapData)
The following object is masked by .GlobalEnv:
LungCap
The following objects are masked from LungCapData (pos = 4):
Age, Caesarean, Gender, Height, LungCap, Smoke
The following objects are masked from LungCapData (pos = 5):
Age, Caesarean, Gender, Height, LungCap, Smoke
The following objects are masked from LungCapData (pos = 6):
Age, Caesarean, Gender, Height, LungCap, Smoke
The following objects are masked from LungCapData (pos = 7):
Age, Caesarean, Gender, Height, LungCap, Smoke
Then I do the classification:
class(LungCap) "numeric"
!!! the Gender classification looks as follows though:
class("Gender")
"character"
So, when I am trying to build the Boxplot, I get the following error all the time:
> boxplot(LungCap)
Fehler in plot.new() : figure margins too large.
2) The command > LungCapData <- read.table(file.choose(), header = T, sep = "t") didn't work for csv as well
> LungCapData <- read.table(file.choose(), header = T, sep = "t")
> attach(LungCapData)
The following object is masked from LungCapData (pos = 6):
LungCap.Age.Height.Smoke.Gender.Caesarean
> class(LungCap)
[1] "numeric"
> class(Gender)
[1] "factor"
> class(Age)
[1] "integer"
> class(Height)
[1] "factor"
> class(Smoke)
[1] "factor"
> class(Caesarean)
[1] "factor"
> boxplot(LungCap)
Fehler in plot.new() : figure margins too large
3) For xlsx: I managed to get the boxplot, yet the lines look very strange to me:
LungCapData <- read_excel("Desktop/study abroad/Online education/R beginning/LungCapData.xlsx",
+ col_types = c("numeric", "numeric", "numeric",
+ "text", "text", "text"))
> View(LungCapData)
> attach(LungCapData)
The following object is masked by .GlobalEnv:
LungCap
The following objects are masked from LungCapData (pos = 5):
Age, Caesarean, Gender, Height, LungCap,
Smoke
The following objects are masked from LungCapData (pos = 6):
Age, Caesarean, Gender, Height, LungCap,
Smoke
The following objects are masked from LungCapData (pos = 7):
Age, Caesarean, Gender, Height, LungCap,
Smoke
The following objects are masked from LungCapData (pos = 9):
Age, Caesarean, Gender, Height, LungCap,
Smoke
The following objects are masked from LungCapData (pos = 10):
Age, Caesarean, Gender, Height, LungCap,
Smoke
The following objects are masked from LungCapData (pos = 11):
Age, Caesarean, Gender, Height, LungCap,
Smoke
The following objects are masked from LungCapData (pos = 12):
Age, Caesarean, Gender, Height, LungCap,
Smoke
> class(LungCap)
[1] "numeric"
> class(Gender)
[1] "character"
> class(Smoke)
[1] "character"
> boxplot(LungCap)
Many thanks and cheers,