fork download
  1. WQ.Outcrop<-read.csv("c:/downloads/1-34.csv", header=T, sep=",") #讀取資料
  2. WQ.Outcrop.n<-WQ.Outcrop[,-c(1,1)]#把第一欄的編號名稱刪掉,避免影響後續的群集分析
  3. WQ.Outcrop.n #確認有刪掉第一欄
  4. means<-apply(WQ.Outcrop.n, 2, mean) #標準化變數,計算每攔變數的平均數,2代表column,1代表row
  5. sds<-apply(WQ.Outcrop.n, 2, sd) #標準化變數,計算每欄變數的標準差,2代表column,1代表row
  6. WQ.Outcrop.n<-scale(WQ.Outcrop.n, center=means, scale=sds) #標準化變數,計算Z分數
  7. dist<-dist(WQ.Outcrop.n, , method="euclidean") #計算歐幾里得距離
  8. nfit<-hclust(WQ.Outcrop.n, method="ward") #以Ward法進行集群分析
  9.  
Success #stdin #stdout #stderr 0.22s 60752KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error in file(file, "rt") : cannot open the connection
Calls: read.csv -> read.table -> file
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'c:/downloads/1-34.csv': No such file or directory
Execution halted