R - avoiding nested loops

I know that for loops, you can avoid almost all the time in R if you understand the language correctly, but I'm struggling to find a smart way to do this

for (i in 1:100){ AllData[[i]]$Div = NULL } 

Where AllData is a list of 100 lists of various sizes. Can someone tell me?

+4
source share
1 answer

Like this:

 AllData <- lapply(AllData, `[[<-`, "Div", NULL) 
+5
source

Source: https://habr.com/ru/post/1435736/


All Articles