How to find a confidence level given the z value
OK, for a 95% confidence interval, you want to know how many standard deviations away from the mean your point estimate is (the "z-score").  To get that, you take off the 5% "tails".  Working in percentile form you have 100-95 which yields a value of 5, or 0.05 in decimal form.  

Divide that in half to get 0.025 and then, in R, use the qnorm function to get the z-star ("critical value").  Since you only care about one "side" of the curve (the values on either side are mirror images of each other) and you want a positive number, pass the argument lower.tail=FALSE.  

So, in the end, it would look like this:

qnorm(.025,lower.tail=FALSE)


yielding a value of 1.959964

You then plug that value into the equation for the margin of error to finish things up.

If you want to go the other direction, from a "critical value" to a probability, use the pnorm function.  Something like:

pnorm(1.959964,lower.tail=FALSE)


which will give you back 0.025