Displaying 3 results from an estimated 3 matches for "anacortes".
2009 Nov 09
3
How to transform the Matrix into the way I want it ???
Hi, R users,
I'm trying to transform a matrix A into B (see below). Anyone knows how to
do it in R? Thanks.
Matrix A (zone to zone travel time)
zone z1 z2 z3 z1 0 2.9 4.3 z2 2.9 0 2.5 z3 4.3 2.5 0
B:
from to time z1 z1 0 z1 z2 2.9 z1 z3 4.3 z2 z1 2.9 z2 z2 0 z2 z3 2.5 z3 z1
4.3 z3 z2 2.5 z3 z3 0
The real matrix I have is much larger, with more than 2000 zones. But I
think it should
2018 May 16
0
Bilateral matrix
Dear Bert and Huzefa,
Apologies for the late reply, my account got hacked and I have just managed
to recover it.
Thank you very much for your replies and the solutions. Both work well.
I was wondering if there was any way to ensure (force) that all possible
combinations show up in the output. The full dataset has 25 cities but of
course people have not moved from Boston to all the other 24
2018 May 08
3
Bilateral matrix
or in base R : ?xtabs ??
as in:
xtabs(~previous_location + current_location,data=x)
(You can convert the 0s to NA's if you like)
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, May 8, 2018 at 9:21 AM, Huzefa