I'm new to R and I'm hoping to turn some output from a NetLogo model I developed into something I can analyze in R.
My NetLogo model consolidates 8 different variables into a list and exports it to R as a huge column of factors:
> tail(d$conflict)
[1] [152 264 558 1053 902 2480 6697 6696] [231 343 430 764 1219 2691 4613 4617]
[3] [240 361 453 803 1283 2805 4881 4884] [253 378 474 838 1338 2919 5134 5136]
[5] [264 394 492 882 1388 3036 5386 5386] [271 419 518 928 1440 3147 5643 5642]
50001 Levels: [0 0 0 0 0 0 0 0] [0 0 0 3 50 35 18 17] ... [999 938 1037 1046 2014 1878 2072 2073]
From the factor in each row, I want to extract each of those individual numbers and put it into one of eight new named variables in a dataframe, such that the first number from the factor in each row is the first row of the first new variable, the second is the second, etc.
Any help would be much appreciated!
Mydf = read.table( text= gsub( "\\[|\\]", "", d$conflict) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With