Description Usage Arguments References Examples

This is an implementation of the radiation model proposed in a paper by Simini et al. (2012).

1 | ```
od_radiation(p, pop_var = "population", proportion = 1)
``` |

`p` |
A SpatialPoints dataframe, the first column of which contains a unique ID |

`pop_var` |
A character string representing the variable that corresponds to the population of the zone or point |

`proportion` |
A number representing the proportion of the population who commute (1, the default, means 100 percent of the population commute to work) |

Simini, F., Gonzalez, M.C., Maritan, A., Barabasi, A.L., 2012. A universal model for mobility and migration patterns. Nature. doi:10.1038/nature10856

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
# load some points data
data(cents)
# plot the points to check they make sense
plot(cents)
class(cents)
# Create test population to model flows
set.seed(2050)
cents$population <- runif(n = nrow(cents), min = 100, max = 1000)
# estimate
flowlines_radiation <- od_radiation(cents, pop_var = "population")
flowlines_radiation$flow
sum(flowlines_radiation$flow, na.rm = TRUE) # the total flow in the system
sum(cents$population) # the total inter-zonal flow
plot(flowlines_radiation, lwd = flowlines_radiation$flow / 100)
points(cents, cex = cents$population / 100)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.