简体   繁体   English

如何在R上使用ddply函数?

[英]How do I use the ddply function on R?

I have a function that gives me the summary statistics of earthquakes for a certain year: 我有一个函数,可提供特定年份的地震摘要统计信息:

I have data on earthquakes from years 1900-2007. 我有1900-2007年地震的数据。 How do I use the ddply function to give me the summary statistics from all years? 如何使用ddply函数为我提供所有年份的摘要统计信息? I am running this but it doesnt do anything. 我正在运行它,但它什么也没做。

allmags <- ddply(.data = quakes, .variables = year, .fun = quake_summary)

您可以尝试以下代码:

allmags <- ddply(quakes, .(year), function(x) summary(x))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM