I'm creating some simulated disease count data for spatial modeling in OpenBUGS via the BRugs
package in R.
I have an existing .txt
file which contains most of the information I need to run my models in BRugs
. Here's what this text file looks like:
list(N = 44,
O = c(4, 8, 3, 6, 2, 7, 7, 2, 10, 13, 5, 7, 9, 3, 3, 1, 2, 3, 19, 7, 5, 4,
9, 2, 4, 6, 14, 13, 6, 7, 9, 3, 4, 10, 10, 8, 23, 24, 18, 10, 6, 4, 17, 7),
E = c(7.20902956, 7.81436792, 3.46693788, 7.04393728, 7.37412184,
4.45749156, 6.3285374, 4.45749156, 6.3285374, 6.76878348, 9,...)
etc....
),
sumNumNeigh = 212
)
What I'd like to accomplish is to replace the O
vector in the above .txt
file with the m
simulated disease count vectors than I generated in R. This way, I can have m
new .txt files to use with BRugs
to run my models.
For instance, let's say this new disease count vector is called O_sim
:
[1] 6 4 6 9 9 6 11 6 7 6 11 9 7 10 9 10 9 3 10 4 6 8 8 4 6 9 8 6 9 8 7 8 5 10 8 6 4 4 5 5 8
[42] 10 8 11
How could I go about created a new .txt file that now looks like this:
list(N = 44,
O = c(6,4,6,9,9,6,11,6,7,6,11,9,
7,10,9,10,9,3,10,4,6,8,8,4,6,
9,8,6,9,8,7,8,5,10,8,6,4,4,5,5,
8,10,8,11),
E = c(7.20902956, 7.81436792, 3.46693788, 7.04393728, 7.37412184,
etc...
),
sumNumNeigh = 212
)