Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 307 Bytes

Exercise3_1.md

File metadata and controls

20 lines (16 loc) · 307 Bytes

Exercise

  • Preallocating a list (or any vector)
x = vector("list", 10)
for(i in 1:10) 
 x[[ letters[i] ]] = i

What will x contain at the end of this?

  • And
x = vector("list", 10)
names(x) = letters[1:10]

for(i in 1:10) 
 x[[ letters[i] ]] = i

What will x contain at the end of this?