绘制 R 中的波动

发布于 2024-12-07 10:55:20 字数 489 浏览 1 评论 0原文

我会尽量不那么含糊。下面的数据集由设备的功率测量组成,我必须绘制一个图表,该图表将显示“时间”列中功率(瓦特)的平均波动。我必须在 R 中完成此操作,但我真的不知道哪个函数或应该如何执行它,因为我是 R 的新手。任何帮助将不胜感激!

Store No.,Date,Time,Watt

33,2011/09/26,09:11:01,0.0599E+03

34,2011/09/26,09:11:02,0.0597E+03

35,2011/09/26,09:11:03,0.0598E+03

36,2011/09/26,09:11:04,0.0596E+03

37,2011/09/26,09:11:05,0.0593E+03

38,2011/09/26,09:11:06,0.0595E+03

39,2011/09/26,09:11:07,0.0595E+03

40,2011/09/26,09:11:08,0.0595E+03

41,2011/09/26,09:11:09,0.0591E+03

I will try to be as less vague as possible. The below data set consists of a device's power measurement and I have to plot a graph which would show the average fluctuation of the power (watt) during the Time column. I have to accomplish this in R but i really don't know which function or how should I do it as i'm a newbie to R. Any help will be highly appreciated!

Store No.,Date,Time,Watt

33,2011/09/26,09:11:01,0.0599E+03

34,2011/09/26,09:11:02,0.0597E+03

35,2011/09/26,09:11:03,0.0598E+03

36,2011/09/26,09:11:04,0.0596E+03

37,2011/09/26,09:11:05,0.0593E+03

38,2011/09/26,09:11:06,0.0595E+03

39,2011/09/26,09:11:07,0.0595E+03

40,2011/09/26,09:11:08,0.0595E+03

41,2011/09/26,09:11:09,0.0591E+03

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

善良天后 2024-12-14 10:55:20

package:zoo 中的 rollapply 将返回移动平均线(或移动任意函数)。您可以使用点进行绘图,然后添加移动平均线:

dat$D.time <- as.POSIXct(paste(dat$Date, dat$Time))
require(zoo)
 ?rollapply
 length(rollapply(dat$Watt,3, mean))
plot(dat$D.time, dat$Watt)
lines(dat$D.time[3:9], rollapply(dat$Watt,3, mean))

rollapply in package:zoo will return a moving average (or a moving any-function). You can plot using points and then add a moving average line:

dat$D.time <- as.POSIXct(paste(dat$Date, dat$Time))
require(zoo)
 ?rollapply
 length(rollapply(dat$Watt,3, mean))
plot(dat$D.time, dat$Watt)
lines(dat$D.time[3:9], rollapply(dat$Watt,3, mean))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文