Hi guys,
I want to create variable on the fly: for example
for (i in 1:10) {
cat(paste(VAR,i,sep=))
}
Will print VAR1, VAR2 etc up to VAR10. However I want to make these into
variables, and then give them a value, for example:
vect = c(10:20)
for (i in 1:10) {
cat(paste(VAR,i,sep=)) =
?assign , or consider a named vector/list.
jimineep wrote:
Hi guys,
I want to create variable on the fly: for example
for (i in 1:10) {
cat(paste(VAR,i,sep=))
}
Will print VAR1, VAR2 etc up to VAR10. However I want to make these into
variables, and then give them a value, for example:
vect = c(10:20)
for (i in 1:10) {
+ assign(paste(VAR,i,sep=), vect[i])
+ }
VAR1
[1] 10
VAR2
[1] 11
2008/8/12 jimineep [EMAIL PROTECTED]
Hi guys,
I want to create variable on the fly: for example
for (i in 1:10) {
cat(paste(VAR,i,sep=))
}
Will print VAR1, VAR2 etc up to VAR10.
On Tue, 12 Aug 2008, jimineep wrote:
Hi guys,
I want to create variable on the fly: for example
See
?assign
HTH,
Chuck
for (i in 1:10) {
cat(paste(VAR,i,sep=))
}
Will print VAR1, VAR2 etc up to VAR10. However I want to make these into
variables, and then give them a value,
jimineep jamesrperkins at hotmail.com writes:
Hi guys,
I want to create variable on the fly: for example
for (i in 1:10) {
cat(paste(VAR,i,sep=))
}
Will print VAR1, VAR2 etc up to VAR10. However I want to make these into
variables, and then give them a value, for example:
On Tue, 12 Aug 2008, Ben Bolker wrote:
jimineep jamesrperkins at hotmail.com writes:
Hi guys,
I want to create variable on the fly: for example
for (i in 1:10) {
cat(paste(VAR,i,sep=))
}
Will print VAR1, VAR2 etc up to VAR10. However I want to make these into
variables, and then give
6 matches
Mail list logo