Apologies if this is a stupid question - but this my first attempt at using R
, and i have ended up writting some code along the lines of:
some <- vector('list', length(files))
thing <- vector('list', length(files))
and <- vector('list', length(files))
another <- vector('list', length(files))
thing <- vector('list', length(files))
Is there a nicer (DRY) way to do this in R
?
To rephrase, I want to assign the same value to multiple variables at once (as per @Sven Hohenstein's answer)
vector('list', length(files))
creates a list of length(files) with each element of the list set toNULL
. This makes me believe that the next thing you are going to do is load a bunch of files into that list using afor
loop. There are better ways to do this in R. – Cornelison