Skip to content
Prev 318718 / 398503 Next

histogram

Hi,

dat1<- read.csv("rightest.csv",sep=",",header=TRUE,check.names=FALSE)
?dat2<- as.dist(dat1[,-1],upper=F,diag=F)
vec1<- as.vector(dat2)
label1=c("0-25","25-50","50-75")
Name1<-unlist(lapply(0:123,function(i) rep(i+1,i)))
dat3<-data.frame(Name1,vec1)
res<-t(aggregate(.~Name1,data=dat3,function(x) table(cut(x,breaks=seq(0,75,25),labels=label1))))
colnames(res)<- res[1,]
res1<- res[-1,]
row.names(res1)<-gsub("vec1.","",row.names(res1))
res1
Names2<-apply(res1,1,function(x) paste(which(x!=0),collapse=","))
res2<- data.frame(Frequency=apply(res1,1,function(x) sum(1*(x!=0))), stations=Names2,stringsAsFactors=FALSE)

res2
#????? Frequency
#0-25??????? 121
#25-50?????? 122
#50-75??????? 76
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? #stations
#0-25??? #1,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123
#25-50 #2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123
#50-75???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? #10,16,22,25,27,30,31,33,34,35,36,37,38,39,40,41,47,48,50,53,56,58,59,61,64,65,68,69,70,73,75,76,77,78,79,80,81,82,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,121,123

A.K.