Dear all,
I have several data frames for which I want to change the column names.
Example data:
data.1 - data.frame(x1 = rnorm(5))
data.2 - data.frame(x1 = rnorm(5))
.
.
What I want to achieve:
names(data.1) - y1
names(data.1) - y1
.
.
Is it possible to achieve this with a loop or any of the
Henrik Parn henrik.parn at bio.ntnu.no writes:
Dear all,
I have several data frames for which I want to change the column names.
Example data:
data.1 - data.frame(x1 = rnorm(5))
data.2 - data.frame(x1 = rnorm(5))
Use lists. I.e.:
data - list()
data[[1]] - data.frame(x1 = rnorm(5))
Hi Henrik,
afaIcs this should work:
for(v in sprintf(data.%d, 1:n)) {
f = get(v)
names(f) = whatever
assign(v, f)
}
--
Best wishes
Wolfgang
--
Wolfgang Huber EBI/EMBL Cambridge UK http://www.ebi.ac.uk/huber
On Mon, 21 Apr 2008, Henrik Parn wrote:
Dear all,
I have several data frames for which I want to change the column names.
Example data:
data.1 - data.frame(x1 = rnorm(5))
data.2 - data.frame(x1 = rnorm(5))
.
.
What I want to achieve:
names(data.1) - y1
names(data.1) - y1
.
.
Is
4 matches
Mail list logo