0 votes
1 view
in R Programming by (42k 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 (90.3k points)

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

set.seed(123)

x <- rnorm(100, 5, 10)

If you want to showcase the mean value:

boxplot(x)

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. 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...