The audacity to do such a thing…

  • canihasaccount@lemmy.world
    link
    fedilink
    arrow-up
    11
    ·
    edit-2
    9 months ago

    Within a loop could be:

    for(i in 1:10){
         assign(paste0("listNum", i), list(i, someStringVector[i], i:(i+20), i*value))
    }```
    
    And you can also use get() in the same way to dynamically retrieve a variable. 
    
    I've gone so far into coding debauchery that I've dynamically assigned variables from dynamically retrieved ones, and I've done so fairly frequently.
    • schroed4 [he/Him]
      link
      fedilink
      arrow-up
      7
      ·
      9 months ago

      Legit thank you.

      I’ve wondered on the right way to do this in R… Too many times.