How to turn a column filled with factorized lists into a dataframe

I am new to R and I am hoping to turn some of the results from the NetLogo model I developed into something that I can parse in R.

My NetLogo model concatenates 8 different variables into a list and exports them 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 coefficient in each line, I want to extract each of these individual numbers and put it in one of eight new named variables in the dataframe, so that the first number from the coefficient in each row is the first row, the first new variable, the second is the second, and so on. ...

Any help would be greatly appreciated!

+3


source to share


1 answer


Mydf = read.table( text= gsub( "\\[|\\]", "", d$conflict) )

      



+5


source







All Articles