Skip to content
Prev 246387 / 398502 Next

Help with "For" instruction

2011/1/4 Andr? Dias <diasandre at gmail.com>:
So how are you using it? It's so much easier to explain what you're doing
wrong if I know what you're doing.

Without a reproducible example I can't show you exactly, but
something like:

 for (i in 1:length(database))
assign(paste("distancematrix",i,sep=""), dist(get(paste("database", i,
sep=""))))

get() is the counterpart of assign(), though there are better (more R-ish)
ways of doing what you want.

Sarah