richard — Jan 14, 2014, 3:35 PM
data<-read.csv("YHRD ruwe data.csv",header=TRUE)
profiles <- as.matrix(data[-1])
mins <- apply(profiles,2,min)
maxs <- apply(profiles,2,max)
ranges <- maxs-mins
tprofiles <- (t(profiles)-mins)
profile.codes <- apply(tprofiles*(c(1,cumprod(ranges+1)[-7])),2,sum)
counts <- sort(tabulate(profile.codes),decreasing=TRUE)
counts<-counts[counts!=0]
plot(counts)
sum(counts)
[1] 12727
length(profile.codes)
[1] 12727
tab <- tabulate(counts)
l <- length(tab)
partition.sizes <- (1:l)[tab!=0]
partition.repeats <- (tab)[tab!=0]
k <- length(partition.sizes)
partition.sizes <- partition.sizes[k:1]
partition.repeats <- partition.repeats[k:1]
partition.sizes
[1] 661 303 299 291 271 196 162 149 146 128 127 125 117 109 100 88 83
[18] 79 76 74 73 70 63 60 59 58 54 53 52 51 46 45 44 43
[35] 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26
[52] 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9
[69] 8 7 6 5 4 3 2 1
partition.repeats
[1] 1 1 1 1 1 1 2 1 1 1 1 1 1 1
[15] 1 1 1 1 1 1 1 1 1 1 1 4 2 1
[29] 1 1 1 2 1 3 2 4 1 1 1 1 2 1
[43] 3 3 8 1 2 3 3 2 5 2 5 3 8 10
[57] 4 5 1 6 8 6 9 16 10 18 18 26 22 35
[71] 57 58 124 177 379 1397