Constructing a 95% Confidence Interval (using output from r-studio) 
Consider a random sample $X_1,X_2,..,X_n$ from a variable with density function
  $$f_X(x)=2\lambda\pi xe^{-\lambda\pi x^2} \ \ \ \ \ \ \  x>0$$
  A useful estimator of $\lambda$ is $$\hat{\lambda}=\frac{n}{\pi\sum_{i=1}^{n} X^2_1}$$
  David was studying the spatial distribution of a native Acacia species.
  At one site, 12 points were randomly selected, and at each point, he measured (in metres) the distance to the nearest Acacia plant. The resulting
  measurements are given below.
  $$ 0.015 \ \ \ 0.09 \ \ \  0.046\ \ \ 0.24 \ \ \ 0.17 \ \ \  0.31$$
  $$0.29 \ \ \ 0.22 \ \ \  0.21 \ \ \ 0.26 \ \ \ 0.34 \ \ \ 0.79$$
  Assume that $f(x)$ is a good model for the density function of point to
  nearest neighbour distance where $λ$ is the density of the Acacia plants
  (in plants per square metre).
  Compute a 95% confidence interval for $λ$ from the above data. You may
  use the following result

> qgamma(c(0.025,0.05,0.95,0.975),6,6)
[1] 0.3669824 0.4355025 1.7521725 1.9447220
> qgamma(c(0.025,0.05,0.95,0.975),12,12)
[1] 0.5167146 0.5770177 1.5172929 1.6401699

The above output is from R.
To compute a 95% confidence interval given a sample of measurements, I thought the interval would take the form
$$\Big(\overline{X}-t_{n-1,0.975}\frac{S}{\sqrt{n}},\overline{X}+t_{n-1,0.975}\frac{S}{\sqrt{n}}\Big)$$
where $S$ is the sample variance, which I calculated to be $0.199$ and $\overline{X}$ is the standard mean which I calculated to be $0.248$. Now for $t_{n-1,0.975}$, I could use a t-value table, but this was not given in the exam. We are required to use the output from R.
Given the information in the question, how should I construct my confidence interval?
 A: When the population distribution is normal (or approximately normal), 95% confidence intervals of the type $\hat \mu \pm 1.96\text{SD}(\hat \mu)/\sqrt{n}$
are used. When it is necessary to estimate $\text{SD}(\hat \mu)$ from the sample, then 1.96 is replaced by a number $t_c$ that cuts 2.5% of the probability from the upper tail of Student's t distribution with the relevant degrees of freedom.
However, when dealing with parameter estimates that have asymmetrical distributions, such as chi-squared or gamma, the type of CI that is symmetrical about $\hat \mu$ is not usually feasible.
@BGM's suggested link deals with another kind of CI that does often work
in such situations. And the method to get the specific CI you seek is indeed shown there.
Perhaps a second example of that kind of CI will be helpful:
If you have $n$ observations from a normal population with unknown variance $\sigma^2,$ here is how to get a CI for $\sigma$ using the sample variance $S^2.$
One can show that $Q = \frac{(n-1)S^2}{\sigma^2} \sim \mathsf{Chisq}(\nu = n-1).$
Then you can find values $L$ and $U$ that cut 2.5% of the area from the lower and upper tails (respectively) of $\mathsf{Chisq}(n-1)$ so that
$$0.95 = P(L < Q < U) = P\left(\frac{(n-1)S^2}{U} < \sigma^2 < \frac{(n-1)S^2}{L}\right).$$
This imples that a 95% CI for $\sigma^2$ is of the form 
$$\left(\frac{(n-1)S^2}{U},\; \frac{(n-1)S^2}{L}\right).$$
Notes: (1) The point estimate $S^2$ of $\sigma^2$ will lie within this CI, but not typically at the center of the interval. (2) By adjusting the amounts of probability (adding to 5%) that are put into each tail, you can usually get a CI that is a bit
shorter. (3) The interval shown above with 2.5% in each tail is called 'probability-symmetric'. (4) To get a 95% CI for the population standard deviation $\sigma$ take square roots of the endpoints of the 95% CI for $\sigma^2.$ (5) You can get the values $L$ and $U$ from printed tables of chi-squared distributions or by using statistical software such as R.
