Hi everybody,
I've been looking around, but can't seem to find the answer. I get a list of names (which vary, so I never know them in advance), and transform them into variables, each of which is a dataframe, using assign: polyList <- c("rs123", "rs124", "rs555", "rs000") numPoly <- length(polyList) for (k in 1:numPoly) { assign(polyList[k], data.frame(matrix(NA, ncol=3, nrow=3))) } polyList <- lapply(polyList, as.name) I can see the resulting dataframe associated to rs123 (for example) using: > eval(polyList[[1]]) X1 X2 X3 1 NA NA NA 2 NA NA NA 3 NA NA NA And see the value in row 1, column 1 with: > eval(polyList[[1]])[1,1] [1] NA Now, I want to change the values in the dataframe... that's what I can't manage to do: > eval(polyList[[1]])[1,1] <- 5 Error in eval(polyList[[1]])[1, 1] <- 5 : could not find function "eval<-" Anybody has an idea on how to do that? Thank you, Stephane PS: yes, I'm aware that using arrays and dataframes instead of going through the creation of variables may be more practical, but the context is much more complex than the presented example (and in that specific case, having these variables is a requirement) -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a compa ny registered in England with number 2742969, whose registered office is 2 15 Euston Road, London, NW1 2BE. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.