How to loop through a list in R How to loop through a list in R r r

How to loop through a list in R


something like this?

dataList=list("Hello", c("USA", "Red", "100"), c("India", "Blue", "76"))for(i in dataList){print(i)}

returns:

[1] "Hello"[1] "USA" "Red" "100"[1] "India" "Blue"  "76"   

or:

for(i in dataList){for(j in i){print(j)}}

returns:

[1] "Hello"[1] "USA"[1] "Red"[1] "100"[1] "India"[1] "Blue"[1] "76"