Very nice and comprehensive post on marginal effects.
Sunday, August 07, 2022
Wednesday, April 27, 2022
Processing the sugar map
Different implementations of the Sugarscpe agent-based model have different ways to get up the sugar map. SugarscapeCW used a built-in matrix (no space between each number) whereas the NetLogo model library uses an external text file with a blank space between each number.
The easy way to translate between these two different format is to use the readr R package, something like this:
library(readr)
sugar_map1 <- read_fwf("~/tmp/sugar-map1.txt", fwf_widths(c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), col_names = NULL))
write_delim(sugar_map1, "~/tmp/sugar-map-out.txt", delim = " ", col_names = FALSE)
Subscribe to:
Posts (Atom)