1# Load the data
2data("USArrests")
3
4# Standardize the data
5df <- scale(USArrests)
6
7# Show the first 6 rows
8head(df, nrow = 6)
1## Alabama Alaska Arizona Arkansas California Colorado
2## Alabama 0.00 2.70 2.29 1.29 3.26 2.65
3## Alaska 2.70 0.00 2.70 2.83 3.01 2.33
4## Arizona 2.29 2.70 0.00 2.72 1.31 1.37
5## Arkansas 1.29 2.83 2.72 0.00 3.76 2.83
6## California 3.26 3.01 1.31 3.76 0.00 1.29
7## Colorado 2.65 2.33 1.37 2.83 1.29 0.00