Nikos Alexandris wrote:
...
> >>> I have 6 data frames consisting of 6 rows x 7 columns put together from
> >>> other data.frames.
...
> >>> I want to give the following column names to each data.frame: ("SDev",
> >>> "PC1", "PC2", "PC3", "PC4", "PC5", "PC6")
...
> >>> How is it to be done at on
Try this
# set up test data
# BOD1 and BOD2 are same as built in BOD
BOD1 <- BOD2 <- BOD
env <- .GlobalEnv
object.names <- objects(pattern = "BOD", env)
# change col names of BOD1 to A & B. Ditto for BOD2.
for(nm in object.names) names(env[[nm]]) <- c("A", "B")
On Thu, Mar 11, 2010 at 7:33 AM,
Amazing! I haven't seen usage of calling `names<-` like this before.
Thanks so much!
On Thu, Mar 11, 2010 at 9:50 PM, Henrique Dallazuanna wrote:
> Yes, just in the list.
> If they want change the name in Environment GlobalEnv:
>
> for(i in ls(pattern = "DF[0-9]"))
> assign(i, `names<-`(ge
Yes, just in the list.
If they want change the name in Environment GlobalEnv:
for(i in ls(pattern = "DF[0-9]"))
assign(i, `names<-`(get(i), c("SDev","PC1", "PC2", "PC3",
"PC4", "PC5", "PC6")), globalenv())
On Thu, Mar 11, 2010 at 10:39 AM, Linlin Yan wrote:
> It seems that the names of o
It seems that the names of original data frames have not changed in
this way. I guess textConnection() could help, like this:
for (name in objects(pattern = "df[0-9]"))
eval(parse(textConnection(paste('names(', name, ') <-
column_names'
On Thu, Mar 11, 2010 at 9:25 PM, Henrique Dallazuanna w
You can try this:
lapply(lapply(ls(pattern = 'DF[0-9]'), get),
'names<-', c("SDev","PC1", "PC2", "PC3", "PC4", "PC5", "PC6"))
On Thu, Mar 11, 2010 at 9:33 AM, Nikos Alexandris
wrote:
> Greets to the list!
>
> I am aware that this topic has been discussed several times. And I've
> read qui
Greets to the list!
I am aware that this topic has been discussed several times. And I've
read quite some related posts [1]. Yet, can't seem to give a solution to
my problem.
I have 6 data frames consisting of 6 rows x 7 columns put together from
other data.frames.
Something like:
a b c d e
7 matches
Mail list logo