Kernel density estimation visualised in R

I’ve been writing an article in which I use a one-dimensional kernel density estimation (KDE). After some thought (and peer review ;-P ) I decided, I needed to visualise how it works.  I couldn’t find any R-code on how to do this online, soooo here it is: My R-code on how to produce a graph which may help explaining KDEs. (more…)