Thankyou for the replies.
assign() works.
for (i in 1:7)
assign(filesBox[i,1],read.table(paste(dir2, filesBox[i,1], sep=""), header =
FALSE))
--
View this message in context:
http://www.nabble.com/using-an-element-of-an-array-as-a-new-object-tp14884435p14917349.html
Sent from the R help mail
I would work with 2 different objects to be safe (you can rename the 2nd
after everything works if you want).
Try something like:
> filesBox2 <- array( list(), dim(filesBox) )
> filesBox2[4,1] <- read.table(paste(dir2, filesBox[4,1], sep=""),
header = FALSE)
.
.
.
Hope this helps,
--
Gregory (
See ?assign.
ppaarrkk wrote:
> I have an array called filesBox. I want to take each element of the first
> column and assign a dataset to it.
>
> For example :
>
> filesBox[4,1] returns
>
> [1] "fileR"
>
> Then I want to assign "fileR" which exists as a text file to the R object
> "fileR" lik
3 matches
Mail list logo