Why the density plot of a vector with uniqe numbers is a normal distribution? The density plot of vector that containing unique number is normal distribution with mean 1:
For example:
plot(density(rep(1,100))

 A: The density functions performs kernel density estimation, which roughly works as follows:
On each observation, a small "bump" shaped like a normal distribution (or similar) is placed; the final curve is then simply the sum of all the small bumps. When all small bumps are identical, namely a normal distribution with mean 1, also the final curve will be a normal distribution with mean 1.
A: This is answered in the documentation ?density ... there is a parameter kernel which defaults to gaussian.  If what you are looking for is uniform density add kernel="rectangular".
plot(density(rep(1,100), kernel="rectangular"))
Other options are "triangular", "epanechnikov", "biweight", "cosine" or "optcosine".
A: The density function sets several defaults which can largely determine the result.  In particular, it sets kernel = "gaussian" which explains the shape of the curve.  More importantly for your case, its sets bw = the bandwidth given by the bw.nrd0() function which uses the standard deviation and interquartile distance to estimate a bandwidth unless these quantities are zero as they are in your case.  In this situation, it uses  0.9 * abs(x[1]) * length(x)^(-0.2) which in your case is 0.3582965 as displayed in your plot which isn't isn't a very good estimate for this data set.  Try manually setting the bw to small quantities such as .01 and .001 and you'll see better approximations to your distribution.  
plot(density(rep(1,100), bw=.001))

You question shows the importance of verifying that the density kernel actually does approximate the input distribution when doing these sorts of calculations.
