R或Excel中的PDF文件,用于包含三个不同variables的多个Excel表单

我是R的学习者,他有一个跨越30年的多个月份的excel文件。 每张纸有3个variables和17列(如下所示)。 我试图找出每张纸上每个variables的概率密度函数(PDFs)。 例如,对于每张纸,在第一个高度(粗体),我想PDF,第二高度,第三高度等等。 方向和速度一样。

这在R中可能吗? 甚至Excel?

Sheet1 Sheet2 Sheet3 Height Direction Velocity Height Direction Velocity Height Direction Velocity **147** 304 2.3 141** 336 2.2 **148** 320 1.4 800 308 2.8 797 351 2.4 806 330 1 1500 310 4.1 1503 335 2 1515 293 0.4 3077 308 9.3 3096 293 4.2 3112 315 1 4299 309 14.1 4325 296 6.4 4342 333 3.3 5704 308 18.9 5733 295 8.4 5753 333 5.7 7361 308 23.6 7388 299 10.5 7409 331 7.9 9388 309 29.1 9404 306 13.3 9425 330 10.4 10610 310 31.1 10616 305 14.6 10638 323 11.5 12051 308 31 12051 301 15 12072 309 12.4 13855 302 27 13853 291 14.3 13874 293 12.6 16354 299 16.3 16352 282 10.8 16374 280 8.7 18549 294 9.2 18552 283 7.7 18572 278 5.2 20643 289 5.8 20649 275 6.2 20670 281 4.8 23860 264 6 23891 260 5.9 23896 269 7.3 26471 267 10.6 26504 269 8.5 26505 269 12.1 31004 245 17.5 31055 262 11.9 31050 254 17.7 

我如何在R或Excel中进行此操作? 我希望有人把我指向正确的方向。 谢谢大家。

你可以使用density函数。

以您的数据为例:

 df <- read.table(text="Height Direction Velocity Height Direction Velocity Height Direction Velocity 147 304 2.3 141 336 2.2 148 320 1.4 800 308 2.8 797 351 2.4 806 330 1 1500 310 4.1 1503 335 2 1515 293 0.4 3077 308 9.3 3096 293 4.2 3112 315 1 4299 309 14.1 4325 296 6.4 4342 333 3.3 5704 308 18.9 5733 295 8.4 5753 333 5.7 7361 308 23.6 7388 299 10.5 7409 331 7.9 9388 309 29.1 9404 306 13.3 9425 330 10.4 10610 310 31.1 10616 305 14.6 10638 323 11.5 12051 308 31 12051 301 15 12072 309 12.4 13855 302 27 13853 291 14.3 13874 293 12.6 16354 299 16.3 16352 282 10.8 16374 280 8.7 18549 294 9.2 18552 283 7.7 18572 278 5.2 20643 289 5.8 20649 275 6.2 20670 281 4.8 23860 264 6 23891 260 5.9 23896 269 7.3 26471 267 10.6 26504 269 8.5 26505 269 12.1 31004 245 17.5 31055 262 11.9 31050 254 17.7", header=TRUE) 

现在将函数density到每列:

 densities <- lapply(df, density) 

绘制第一个高度密度和叠加其他两个高度(他们几乎相同):

 plot(densities[[1]], main = "height") lines(densities[[4]], col="red") lines(densities[[7]], col="blue") 

在这里输入图像说明