作者:玲子0909_366 | 来源:互联网 | 2023-10-12 23:07
篇首语:本文由编程笔记#小编为大家整理,主要介绍了r 06解决方案5.R相关的知识,希望对你有一定的参考价值。
# Solution 5
# S Surface 3d ------------------------------------------------------------
nbins <- 20
x.bin <- seq(0, 1000, length= nbins)
y.bin <- seq(0, 700, length= nbins)
freq <- as.data.frame(table(findInterval(x = d[,1], vec = x.bin),
findInterval(x = d[,2], vec = y.bin))) # generates a frequency matrix
freq[,1] <- as.numeric(freq[,1])
freq[,2] <- as.numeric(freq[,2])
freq2D <- diag(nbins)*0 # create a square matrix with nbin rows.
freq2D[cbind(freq[,1], freq[,2])] <- freq[,3] # Generates frequence mastrix
surface3d(x.bin,y.bin,freq2D/5, col="steelblue")
# E Surface 3d ------------------------------------------------------------