[ndnSIM] Re: How to display the total value

Alex Afanasyev alexander.afanasyev at ucla.edu
Sun Dec 1 12:53:50 PST 2013


Hi Yowaraj,

I'm not very confident what exactly you're trying to sum up and why do you have multiple entries for the same sequence number for the same node..  But in any case.  If you want to group data by second, you need to adjust time column as well.  Something like:

data$Time = floor(data$Time)

Alternatively, I can suggest you to import data into sqlite3 database and do a simple select-based operation there. I may be faster (if you have a lot of data) and more straightforward.

---
Alex

On Nov 23, 2013, at 4:26 AM, Yowaraj Chhetri <yowarj at gmail.com> wrote:

> Dear all,
> 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.
> 
> app-delays-trace.txt
> Time        Node    AppId    SeqNo    Type    HopCount
> 10.0057    leaf-1    1             0    LastDelay    4
> 10.0057    leaf-1    1             0    FullDelay     4
> 10.0066    leaf-1    1             1    LastDelay    2
> 10.0066    leaf-1    1             1    FullDelay     2
> 11.0029    leaf-2    2             0    LastDelay    2
> 11.0029    leaf-2    2             0    FullDelay     2
> 11.0057    leaf-1    1             0    LastDelay    4
> 11.0057    leaf-1    1             0    FullDelay     4
> 11.0057    leaf-1    1             0    LastDelay    4
> 11.0057    leaf-1    1             0    FullDelay     4
> 
> My original code is
> 
> data = read.table ("app-delays-trace.txt", header=T)
> data$Node = factor (data$Node)
> data$AppId <- factor(data$AppId)
> data$HopCount <- data$HopCount
> data$Type = factor (data$Type)
> 
> 
> # exlude irrelevant types
> data = subset (data, Type %in% c("FullDelay"))
> data = subset (data, Node %in% c("leaf-1"))
> data = subset (data, AppId %in% c("1"))
> 
> # combine stats from all faces
> data.combined = summaryBy (. ~ Time + Node + AppId + Type, data=data, FUN=sum)
> 
> g.root <- ggplot (data.combined) +
>   geom_point (aes (x=Time, y=HopCount.sum, color=Type), size=0.5) +
>   geom_line (aes (x=Time, y=HopCount.sum, color=Type), size=0.5) +
>   ylab ("Hop Count")
> 
> print (g.root)
> 
> png ("app-delay-1.png", width=500, height=250)
> print (g.root)
> dev.off ()
> 
> 
> With kind regards,
> 
> Yowaraj Chhetri
> Japan





More information about the ndnSIM mailing list