<div dir="ltr">Dear all,<br>I am new to R and ggplot2 to display data acquired from ndnSim, When I run the flowing code, it
displays HopCount 4 and 2 at time 10sec respectively and 4 and 4 in time
11sec. But I want to have it display as 6 (sum of HopCount) in time
10sec and similarly sum of HopCount 8 for 11sec...and so on. How to do
that, Please help me.<br><br>app-delays-trace.txt<br>Time Node AppId SeqNo Type HopCount<br>10.0057 leaf-1 1 0 LastDelay 4<br>10.0057 leaf-1 1 0 FullDelay 4<br>
10.0066 leaf-1 1 1 LastDelay 2<br>10.0066 leaf-1 1 1 FullDelay 2<br>11.0029 leaf-2 2 0 LastDelay 2<br>11.0029 leaf-2 2 0 FullDelay 2<br>
11.0057 leaf-1 1 0 LastDelay 4<br>11.0057 leaf-1 1 0 FullDelay 4<br>11.0057 leaf-1 1 0 LastDelay 4<br>11.0057 leaf-1 1 0 FullDelay 4<br>
<br>My original code is<br><br>data = read.table ("app-delays-trace.txt", header=T)<br>data$Node = factor (data$Node)<br>data$AppId <- factor(data$AppId)<br>data$HopCount <- data$HopCount<br>data$Type = factor (data$Type)<br>
<br><br># exlude irrelevant types<br>data = subset (data, Type %in% c("FullDelay"))<br>data = subset (data, Node %in% c("leaf-1"))<br>data = subset (data, AppId %in% c("1"))<br><br># combine stats from all faces<br>
data.combined = summaryBy (. ~ Time + Node + AppId + Type, data=data, FUN=sum)<br><br>g.root <- ggplot (data.combined) +<br> geom_point (aes (x=Time, y=HopCount.sum, color=Type), size=0.5) +<br> geom_line (aes (x=Time, y=HopCount.sum, color=Type), size=0.5) +<br>
ylab ("Hop Count")<br><br>print (g.root)<br><br>png ("app-delay-1.png", width=500, height=250)<br>print (g.root)<br>dev.off ()<br><br><br>With kind regards,<br><br>Yowaraj Chhetri<br>Japan
</div>