Hi:
Perhaps
> dd <- read.table(textConnection("
+ Vehicle Start End Time
+ 1 A B 5
+ 2 A C 4
+ 3 A C 3
+ 4 B A 6
+ 5 B C 4
+ 6 B C 6
+ 7 C B 2
+ 8 C B 4
+ 9 A B 7"), header = TRUE)
> closeAllConnections()
with(dd, xtabs(Time ~ Start + End)/table(Start, End))
End
Start A B C
A 6.0 3.5
B 6.0 5.0
C 3.0
Interesting output :)
HTH,
Dennis
On Thu, Oct 7, 2010 at 4:40 AM, sugimoto <[email protected]> wrote:
>
> Hi,
>
> I have the following problem:
> I have a list of entries with vehicles going from some places to others and
> the time that they need.
> e.g.
> Vehicle Start End Time
> 1 A B 5
> 2 A C 4
> 3 A C 3
> 4 B A 6
> 5 B C 4
> 6 B C 6
> 7 C B 2
> 8 C B 4
> 9 A B 7
>
> What I need is a 2d table with the average time needed from Start to End,
> e.g.
> A B C
> A NA 6 3.5
> B 6 NA 5
> C NA 3 NA
>
>
> Any help would be very much appreciated,
> Sugi
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Create-2d-table-with-mean-of-entries-tp2966610p2966610.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.