我需要从xml文件中提取数据并绘制图形:深度与时间戳.标题应该是IFC代码.我尝试使用xmlToList和xmlTodataframe,但我没有这样做.我需要帮助.我的xml文件看起来像
<document>
<site>
<IFC_code>HONEYCR01</IFC_code>
<Latitude>41.960161</Latitude>
<Longitude>-90.470759</Longitude>
<River>Honey Creek</River>
<Road>Hwy 136, 1st Street</Road>
<Town>Charlotte</Town>
<from_sensor_to_river_bottom>9.35</from_sensor_to_river_bottom>
<Unit>foot</Unit>
</site>
<data>
<value>
<timestamp>2012-05-17 15:30:03-05</timestamp>
<depth>8.53</depth>
</value>
<value>
<timestamp>2012-05-17 14:30:06-05</timestamp>
<depth>8.50</depth>
</value>
<value>
<timestamp>2012-05-17 14:15:02-05</timestamp>
<depth>8.51</depth>
</value>
<value>
<timestamp>2012-05-17 14:00:12-05</timestamp>
<depth>8.50</depth>
</value>
<value>
<timestamp>2012-05-17 13:45:08-05</timestamp>
<depth>8.51</depth>
</value>
</data>
</document>
Run Code Online (Sandbox Code Playgroud) 这是我的文本文件中的数据:(我已经显示了10,000行中的10行)索引是rownames,temp是时间序列,m是以mm为单位的值.
"Index" "temp" "m"
1 "2012-02-07 18:15:13" "4297"
2 "2012-02-07 18:30:04" "4296"
3 "2012-02-07 18:45:10" "4297"
4 "2012-02-07 19:00:01" "4297"
5 "2012-02-07 19:15:07" "4298"
6 "2012-02-07 19:30:13" "4299"
7 "2012-02-07 19:45:04" "4299"
8 "2012-02-07 20:00:10" "4299"
9 "2012-02-07 20:15:01" "4300"
10 "2012-02-07 20:30:07" "4301"
Run Code Online (Sandbox Code Playgroud)
我使用这个导入r:
x2=read.table("data.txt", header=TRUE)
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下代码将时间序列聚合到每日数据:
c=aggregate(ts(x2[, 2], freq = 96), 1, mean)
Run Code Online (Sandbox Code Playgroud)
我已将频率设置为96,因为15分钟的数据24小时将覆盖96个值.
它告诉我这个:
Time Series:
Start = 1
End = 5
Frequency = 1
[1] 5366.698 5325.115 5311.969 5288.542 5331.115
Run Code Online (Sandbox Code Playgroud)
但我想要与原始数据相同的格式,即我也想要值旁边的时间序列.我需要帮助才能实现这一目标.
我使用以下代码绘制了值:
png(filename="q.png", width=3000, height=1600, units="px")
Run Code Online (Sandbox Code Playgroud)
但是x和y轴上的值似乎太小了.我想放大它们.我怎么做?
我有这些载体:
>dput(SHLRK03)
c("CHSLSCR01", "SHLRK04", "SHLRK05", "WLLWCR01", "WLLWCR02",
"WNBGORV01", "WNBGORV02", "WNBGORV03", "WNBGORV04", "WNBGORV05",
"WNBGORV06")
> dput(SHLRK04)
"SHLRK05"
> dput(WNBGORV01)
c("WLLWCR02", "WNBGORV02", "WNBGORV03", "WNBGORV04", "WNBGORV05",
"WNBGORV06")
Run Code Online (Sandbox Code Playgroud)
我希望通过以下方式获得单个连接图:
我还有几个相互连接的值.我试图在堆栈溢出和网络上搜索这种类型的图,但无法找到任何示例.
有人可以帮帮我吗?我感谢您的时间和精力.
我有深度与时间的关系:
这个情节在5月初有一个奇怪的差距.

我检查了数据,但没有NAs或Nans或没有丢失的数据.这是15分钟的定期间隔的时间序列
我不能在这里给出数据集,因为它包含10,000行.有人可以提出可能的建议吗?
我使用以下绘图代码:
library(zoo)
z=read.zoo("data.txt", header=TRUE)
temp=index(z[,1])
m=coredata(z[,1])
x=0.001
p=rep.int(x,length(temp))
png(filename=paste(Name[k],"_mean1.png", sep=''), width= 3500, height=1600, units="px")
par(mar=c(13,13,5,3),cex.axis= 2.5, cex.lab=3, cex.main=3.5, cex.sub=5)
plot(temp,m, xlab="Time", ylab="Depth",type='l', main=Name[k])
symbols(temp,m,add=TRUE,circles=p, inches=1/15, ann=F, bg="steelblue2", fg=NULL)
dev.off()
Run Code Online (Sandbox Code Playgroud)