shakthydoss - 9 months ago 60

R Question

I have a vector of data and it is normally distributed.

I get a clear bell shape from the chart.

Question is how do I get data only belonging to 1sd (68% of data)

Answer Source

Suppose you vector is `x`

, you can use `x[abs(x - mean(x)) < sd(x)]`

to extract data distributed around 1 standard error of the mean.

An alternative method (maybe more preferred) is `x[abs(scale(x)) < 1]`

, where `scale(x)`

gives standardized / normalized `x`

.