Question: how to calculate variance and standard deviation in r?
Answer: Sample variance and Standard Deviation using R var(y) instructs R to calculate the sample variance of Y. In other words it uses n-1 'degrees of freedom', where n is the number of observations in Y. sd(y) instructs R to return the sample standard deviation of y, using n-1 degrees of freedom. sd(y) = sqrt(var(y)).