It not too simple what ls return the variable that have been create in your 
environment even if you change their names, ls will not return "a1" "b1" ...

The names attribute in OOP of an object is just an attribute and it is 
different with an instance of the object. ls() show instance

But you can try this :

a<-10
> ls()
[1] "a"

assign(paste(deparse(substitute(a)),"1",sep=""),a)                  # here I 
create a new instance with name                                                 
                                            # a1 and the same value than a
rm(a)                                                                           
         # In destroy the original.

>ls()
[1] "a1"


 
Justin BEM
BP 1917 Yaoundé
Tél (237) 99597295
    (237) 22040246

----- Message d'origine ----
De : Luca Laghi <[EMAIL PROTECTED]>
À : r-help@stat.math.ethz.ch
Envoyé le : Vendredi, 3 Août 2007, 15h23mn 01s
Objet : [R] change the names of all listed objects

Dear list members,
I have created seven objects, from a to g, so that ls() gives me
[1] "a" "b" "c" "d" "e" "f" "g"

how can I automatically change their names in

"a1" "b1" "c1" "d1" "e1" "f1" "g1"

It seems simple, ut it is driving me mad.
Thank you very much for your help.
Luca Laghi

______________________________________________
R-help@stat.math.ethz.ch 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.







      
_____________________________________________________________________________ 

l 
        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to