There are many useful statistical functions in the R language. For example arithmetic averages:
Mean (x)
Find the average of x.
Mean (x, trim=0.05, Na.rm=true)
A truncated average is provided, which discards the data with a maximum of 5% and a minimum of 5% and the arithmetic averages after all missing values.
Common statistical functions provided by R:
function |
Describe |
Mean (x) |
Average |
Mean (c (1,2,3,4)) return value is 2.5 |
Median (x) |
Number of Median |
Median (c (1,2,3,4)) return value is 2.5 |
SD (x) |
Standard deviation |
SD (C (1,2,3,4)) return value is 1.29 |
var (x) |
Variance |
VAR (c (1,2,3,4)) return value is 1.67 |
Mad (x) |
Absolute median difference (median absolute deviation) |
Mad (C (1,2,3,4)) return value is 1.48 |
Quantile (X,probs) |
To find the number of bits. where x is the numerical vector of the number of probs to be divided into a probability value between [0,1] |
The numerical vector |
# 30% and 84% sub-sites for X |
Y <-quantile (x, C (. 3,.84)) |
Range (x) |
Ask for a domain |
x <-C (1,2,3,4) |
Range (x) return value is C (1,4) |
diff (Range (x)) |
The return value is 3 |
SUM (x) |
Sum |
Sum (c (1,2,3,4)) returns a value of 10 |
diff (X, lag=n) |
Lag differential, lag is used to specify several lags. The default lag value is 1 |
x<-C (1, 5, 23, 29) |
diff (x) return value is C (4, 18, 6) |
MIN (x) |
To find the minimum value |
Min (c (1,2,3,4)) return value is 1 |
Max (x) |
To find the maximum value |
Max (c (1,2,3,4)) |
The return value is 4 |
Scale (X,center=true, Scale=true) |
Center (center=true) or standardize (Center=true,scale =true) for data object x by column; |
R Language Learning notes-statistical functions