Calculating Confidence Intervals: Confidence intervals help quantify the uncertainty around point estimates. You can calculate a confidence interval for the mean using the t.test() function. For a 95% confidence interval:
ci_result <- t.test(data_vector, conf.level = 0.95)$conf.int
Interpreting Confidence Intervals: A 95% confidence interval for a mean, say (8.5, 9.5), means that if you were to sample from the population many times and calculate intervals, approximately 95% of those intervals would contain the true population mean.