Below is my data set in CSV
Name Age
Sudira,23
Suas,28
Sumi,26
Suresh,29
Rakesh,53
Ravi,22
Roshan,30
Raghu,27
Srikanth,35
Guru|,23
I am trying to find confidence interval using ci(x,confidence=0.95). I am getting below error
Error in UseMethod("ci") :
no applicable method for 'ci' applied to an object of class "data.frame"
Pkg :gmodels has been installed
gmodels::ci() calculates confidence intervals for model estimates, and I believe you want to estimate a confidence interval for the population mean, so you can try using something like this.
If it's the gmodels::ci() function, then you need to pass it a numeric vector.
a.new <- a[2] creates a new data.frame with just the second column from a. In general, single-bracket subsetting will return an object with the same class. I.e., class(a) is the same as class(a[2]).
To extract a single component, use double-bracket subsetting: a[[2]].
Also, it's often better to use names instead of numeric indices. It makes the code less brittle when data is rearranged, and easier to read: a[["Age"]].