How to calculate mean and standard deviation in R given confidence interval and a normal or gamma distribution? Suppose you are given a $95 \%$ CI $(1,6)$ based on the normal distribution. Is there any easy way to find $\mu$ and $\sigma$? What if it came from a gamma distribution? Can we do this in R?
 A: If you mean the true parameters of course the answer is no.  But if you mean that you want to recover the sample estimates from the confidence interval the answer is yes for the normal distribution if the sample size $n$ is also given.
If the confidence interval was $(1,6)$, then $1= \overline{X}-1.96 \cdot S/\sqrt{n}$ and $6=\overline{X}+1.96 \cdot S/\sqrt{n}$.  So $\overline{X}= (6+1)/2=3.5$
and then $6=3.5 +1.96 \cdot S/\sqrt{n}$ or $S=\sqrt{n} 2.5/(1.96)$.
For the gamma distribution this paper shows various ways to get the approximate and exact confidence intervals for rates.  Getting the parameter estimates from these confidence intervals may be complicated.
A: Please read the erratum at the end of the answer.
First note that there is not enough information to solve this problem. In both cases, $n$ the sample size is missing. In the case of the Gaussian distribution, assuming you know $n$, you can easily do it by following @Michael Chernick's instructions. In R that would give something like this (with $n=43$ for the sake of the example).
n <- 43
ci <- c(1,6)
# Take the middle of the CI to get x_bar (3.5).
x_bar <- mean(ci)
# Use 1 = x_bar - 1.96 * sd/sqrt(n)
S2 <- n^2 * (x_bar - ci[1])/1.96

For the case of the Gamma distribution, things are a bit more complicated because it is not symmetric. So the mean is not in the center of the CI.
For example, say you sample from a Gamma population $\Gamma(\alpha,1)$ where $\alpha$ is unknown. The sample mean is the sum of $n$ variables distributed as $\Gamma(\alpha,1)$ divided by $n$, so it is a variable distributed as  $\Gamma(n\alpha,1/n)$. Say that we observed a mean of $1.7$ for a sample size of $n=5$. There are several CI that contain this value as we can check.
> qgamma(.975, shape=1.7*5, scale=1/5)
[1] 3.019101
> qgamma(.975, shape=1.7*5, scale=1/5, lower.tail=F)
[1] 0.7564186

A 95% CI for $\alpha$ is $(.756, 3.019)$, the middle of which is $1.89$, not $1.70$. In short, finding the $\alpha$ and $\theta$ that produce a 95% CI is possible because the solution is unique, but it is a hack.
Fortunately, as $n$ increases, the distribution becomes more and more Gaussian and symmetric, so the CI will be symmetric around the mean. The mean and variance of a $\Gamma(n\alpha,\theta/n)$ are $\alpha\theta$ and $\alpha\theta/n$, so you can use the results of the Gaussian case and solve this very simple equation to get $\alpha$ and $\theta$.
Erratum: Following @whuber's comment I realized that the proposed way to get a confidence interval for $\alpha$ is not good.
The example given above was meant to demonstrate that getting CI with Gamma variables is much more tedious than with Gaussian variables. My mistake proves the point even better. At @whuber's prompt I will show that the CI I proposed is incorrect.
set.seed(123)
# Simulate 100,000 means of 5 Gaussian(0,1) variables (positive control).
means <- rnorm(100000, sd=1/sqrt(5))
upper <- means + qnorm(.975)/sqrt(5)
lower <- means - qnorm(.975)/sqrt(5)
mean((upper > 0) & (lower < 0))
[1] 0.95007 # OK.
# Simulate 100,000 means of 5 Gamma(1,1) variables.
means <- rgamma(100000, shape=5, scale=1/5)
upper <- qgamma(.975, shape=5*means, scale=1/5)
lower <- qgamma(.975, shape=5*means, scale=1/5, lower.tail=FALSE)
mean((upper > 1) & (lower < 1))
[1] 0.94666 # Almost, but not quite.

A: You can construct a confidence interval around anything that can be estimated, whether it be a mean, standard deviation, even a maximum for any given probability distribution.
Assuming you have a CI around the mean estimated from an experiment in which a finite sample of size $n$ were taken from independent, identically distributed random normal variables, then you know the exact confidence interval is given by the sample mean plus or minus 1.96 times the standard error, which is the sample standard deviation scaled by the square root of the sample size. $\bar{x} \pm \mathcal{Z}_{\alpha/2} \left( s/\sqrt{n} \right)$. Your estimates of these parameters, conventionally labeled as $\bar{x}$ and $s$ are the "best guesses" for the "population mean" $\mu$ and "standard deviation" $\sigma$. 
These estimators also estimate the same values regardless of the distribution of your independent samples or the corresponding sampling distribution of the mean. Note however, that the confidence interval is asymptotic and these estimates are not necessarily the best anymore.
A: If what is given are the quantiles from a normal distribution (although not the same as confidence intervals) then a solution to the problem reduces to find the distribution parameters from quantiles.
For the normal distribution we want to find $\mu$ and $\sigma$ such that the random variable $X$ satisfies:
$$
P(X<x_1) = p_1
$$
$$
P(X<x_2) = p_2
$$
The random variable $X$ has the same distribution as $\mu Z + \sigma$ where $Z$ is a standard normal random variable $Z \sim N(0,1)$ and cdf $\phi$ .
This implies that :
$$
\phi^{-1}(p_i)\sigma+\mu=x_i
$$
In R an example given that 20 and 40 are the 0.05 and 0.95 quantiles then.
approx_sd <- function(x1, x2){
  (x2-x1) / (qnorm(0.95) - qnorm(0.05) )
}
approx_sd(20, 40)


approx_mean <- function(x1, x2){
  (x1*qnorm(0.95) - x2*qnorm(0.05)) / (qnorm(0.95) - qnorm(0.05) )
}
approx_mean(20, 40)

For the gamma, the solution is more involved because the inverse CDF has not a closed-form. However, there exist tools and software that automate this complex problem, for example, ParameterSolver downloadable from the following repository https://biostatistics.mdanderson.org/SoftwareDownload/
Although your question parts from a frequentist confidence interval which is of course, not a quantile, the text might indicate that readers can arrive at this question looking for a quantile parameterised distribution which is a topic of active research. 
