User Tools

Site Tools


cs:classification:solution_ex1

Řešení cvičení 1

# import of data via clipboard
 
veg.data <- read.delim ('clipboard', row.names = 1)
env.data <- read.delim ('clipboard', row.names = 1)
 
# calculating distance matrix (square root transformation of data)
dis <- dist (sqrt (veg.data), 'euclidean')
 
# classification using ward
cluster.ward <- hclust (dis, 'ward')
 
# plotting the dendrogram
plot (cluster.ward)
 
# plotting the boxes around
rect.hclust (cluster.ward, k = 5, border = 'blue')
 
# boxplot with differences in pH
cl <- cutree (cluster.ward, k = 5)
boxplot (env.data$pH.H ~ as.factor (cl), xlab = 'Group', ylab = 'pH')

cs/classification/solution_ex1.txt · Last modified: 2017/10/11 20:36 (external edit)