Explore Courses Blog Tutorials Interview Questions
0 votes
in R Programming by (50.2k points)
My data frame is based on the monthly time-series and from that, I need to generate a boxplot on this data using R. Apart from the median, 1st quartile, and 3rd quartile, I also want to visualize in the graph specific data points coming from the time-series, particularly the observations at 3 years, 1 year, and 3 months in the past. Is there a process for adding these observations to the boxplot?

1 Answer

0 votes
by (108k points)

For adding values apart from the median, 1st quatrile, and 3rd quatrile in the boxplot, you can use the text function:


x <- rnorm(100, 5, 10)

If you want to showcase the mean value:


text(1, mean(x), "x", col = "red")

Additionally or alternatively, you can use the function points:

points(IQR(x), col = "blue", pch = 8)

Learn R programming from scratch if you are a beginner and want to know more about R. 

Browse Categories