Data Types and Vector Creation
- Nominal → names
- Ordinal → order
- Interval → equal spacing
- Ratio → real math possible

Creating Vectors
c(1, 2, 3) # numeric
c("a", "b") # text
c(TRUE, FALSE) # logicalVector Functions
numeric(5) # 0 0 0 0 0
rep(2, 5) # 2 2 2 2 2
seq(1, 10) # 1 to 10
Matrix Operations
A matrix is a table of numbers: matrix(1:12, nrow=3)
+ → add%*% → matrix multiplyt() → transposesolve() → inversedet() → determinant
Note: Standard deviation is the square root of the variance.






Understanding trim=0.10 in R
It means to trim 10% from each end of the dataset.
Reading Data
return <- fund_return[,1]
Descriptive Statistics Functions
length(return)
Gives the number of observations (e.g., 76).
mean(return)
Calculates the ordinary average.
median(
...
Continue reading "Essential R Commands for Statistical Data Analysis" »