I am transferring between NetLogo and igraph (in R). Some of the information returned from igraph is 2-level nested lists of strings. Typical example looks like:
[ ["1" "2" "3"] ["4"] ]
I want to convert the internal strings into numbers, while retaining the list structure. So the example would become:
[ [1 2 3] [4] ]
I am guessing I need a combination of map
and read-from-string
(and perhaps other list manipulation like lput
and foreach
due to the nesting), but I just can't make it work.
Any ideas?
Essentially, map each list to a mapped list with only int values. Try the following:
show map [ map [ read-from-string ? ] ?] [ ["1" "2" "3"] ["4"] ]
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