Migration(or conversion) path map in R -


I need to map the migration (or conversion) path to R.

Example My Data.fr

  ID Order State 1 1A1BB3B2 1B2BB2C3B1B32C4 1 A4 B2B1 1C   

In this data. ID ID 1 - & gt; B - & gt; According to order of B.

In the same scenario, the ID has moved to B - & gt; B - & gt; C, id3b- & gt; C, ID4 has A-> B has moved in.

Overall, we can do the migration (or conversion) path management as below.

In this map, the arrow has the frequency of the path information. And in the circles is the frequency information of the states.

migration

Map of this route in R How can i make Is there any package for this?

There is a possibility to use the diagram package here. Most of the work here changes the data into a good format. There can be more efficient methods, but it seems to work at least. First of all, I also want to make sure that your data is treated as one factor rather than a numerical value.

  #sample Input Data DD < -structure (list = 1 (C, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 4L, 4L, 5L) 1L), State = Structure (C (1 L, 2L, 2L, 2L, 2L, 3L, 2L, 3L, 1L, 2L, 3L) .Label = C ("A", "B", "C"), Name = c ("id", "command", "state"), class = "data.frame", line.Name = c (na, -11 l)) dd $ command & lt; -Factor (DD $ order)   

Now we start the change

  ss < - interaction (dd $ state, dd $ command) embed & lt; - Function (x) if (Length X) & gt; 1) Embed (x, 2) other numeric (0) adj  > 
  rownames (tt) & lt; - paste (level (dd $ state), table (dd $ state, dd $ order), sep = "/")   < P> And now we focus on the layout. Allocate positions in each board, then conspirate the diagram with the changes, and finally add text to the top.  
  xpos   

The end result

Enter the image details here

I tried to empower it as per various states / orders but I did not test it completely. So make sure to check the results again with your actual stats.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -