[R] adding a data point on a boxplot

Pierre Micallef micallefpierre at hotmail.com
Mon Jul 25 12:20:20 CEST 2016


Hi


Please could somebody offer some assistance with the following problem?

I am trying to use the boxplot function. As standard it displays (min, lower Q, median, Upper Q and Max). For each dotplot I would also like to add the current/most recent value from my data series as a data point. The goal being to graphically show where current values are compared to the above standard statistics.

I have removed the date columns from the data but it should be in descending order i.e. the last data point in each series should be the current value.

Happy for someone to amend the whole code if there is a smarter way of doing it.

Thanks for any help you can give with this.

See code below:

blpConnect()


data<-data.frame(LargeValue=bdh("DJUSVL Index", c("PX_LAST"), start.date=Sys.Date()-252*5),
                 LargeGrowth=bdh("DJUSGL Index", c("PX_LAST"), start.date=Sys.Date()-252*5))
data <- data[,!names(data) %in% c("LargeValue.date","LargeGrowth.date")]
boxplot(data, las = 2, names = c("Large Value"," Large Growth"), col = c("red","royalblue2"),main=toupper("Box Plot Value vs Growth"), Xlab="Index Level", range = 0, horizontal=TRUE)



Thanks
Pierre

	[[alternative HTML version deleted]]



More information about the R-help mailing list