Yates' continuity correction in confidence interval returned by prop.test This is the confidence interval estimated by prop.test
n <- 600; x <- 276; p <- 0.40
prop.test(x, n, p, alternative="two.sided", conf.level=0.95, correct=T)
95 percent confidence interval:
 0.4196787 0.5008409 

I tried to reproduce it, reading the code under prop.test. Here is a simplified way to get those two limits
ESTIMATE <- x/n
YATES <- 0.5
conf.level <- 0.95
z <- qnorm((1 + conf.level)/2)
YATES <- min(YATES, abs(x - n * p)) 
z22n <- z^2/(2 * n)
p.c <- ESTIMATE + YATES/n
(p.c + z22n + z * sqrt(p.c * (1 - p.c)/n + z22n/(2 * n)))/(1 + 2 * z22n)
[1] 0.5008409
p.c <- ESTIMATE - YATES/n
(p.c + z22n - z * sqrt(p.c * (1 - p.c)/n + z22n/(2 * n)))/(1 + 2 * z22n)
[1] 0.4196787

Can you explain to me why the underlying probability of success (p) is used in line 5? or maybe you could suggest where can I find more info about this YATES correction that affects the ESTIMATE.
Thank you
 A: On the second question of where you can find more info on this continuity correction (attributed to Yates in the help for prop.test but not in the refs below, I think as Yates orginally proposed a continuity correction only to the chi-squared test for contingency tables):


*

*Newcombe RG. Two-sided confidence intervals for the single proportion: comparison of seven methods. Stat Med 1998; 17(8):857-872. PMID:9595616

*Brown LD, Cai TT, DasGupta A. Interval estimation for a binomial proportion (with Comments &  Rejoinder). Statistical Science 2001; 16(2):101-133. doi:10.1214/ss/1009213286
The continuity-corrected Wilson score interval is 'method 4' in Newcomb. Brown et al. consider only the uncorrected Wilson score interval in the main text, but George Casella suggests using the continuity-corrected version in his Comment (p121), which Brown et al. discuss in their Rejoinder (p130):

Casella suggests the possibility of performing
  a continuity correction on the score statistic
  prior to constructing a confidence interval. We do
  not agree with this proposal from any perspective.
  These “continuity-corrected Wilson” intervals
  have extremely conservative coverage properties,
  though they may not in principle be guaranteed to
  be everywhere conservative. But even if one’s goal,
  unlike ours, is to produce conservative intervals,
  these intervals will be very inefficient at their normal
  level relative to Blyth–Still or even Clopper–
  Pearson.

The Clopper-Pearson 'exact' interval is provided by binom.test in R. I'd suggest using that rather than prop.test if you want a conservative interval, i.e. one that guarantees at least 95% coverage. If you'd prefer an interval that has close to 95% coverage on average (over p) and will therefore often be narrower, you could use prop.test(…, correct=FALSE) to give the uncorrected Wilson score interval.
The standard textbook for such matters is Fleiss Statistical Methods for Rates and Proportions. Newcomb references the original 1981 edition but the latest edition is the 3rd (2003). I haven't checked it myself, however.
A: The help page indicates that "Continuity correction is used only if it does not exceed the difference between sample and null proportions in absolute value." This is what line 5 is checking: x/n is the empirical proportion, p is the null proportion. (Actually, I find the "if" slightly misleading since it's more of a "insofar as it does not exceed" when looking at line 5.)
