density() — Density (KDE)

A smooth curve showing where data is crowded.

plot(density(x))

Key idea

Definition

each data point
how many points
the bandwidth (smoothing width)
the kernel — a little bump at each point
the estimated density at x

In plain words

Like a histogram — a bar chart of how often values occur — with the bumps sanded down into one smooth hill.

Where you'd use it

Frequently asked questions

What controls the smoothness?
The bandwidth — too wide hides peaks, too narrow adds spikes.