Skip to content
Back to formatted view

Raw Message

Message-ID: <3EEE759A.30907@pdf.com>
Date: 2003-06-17T01:57:46Z
From: Spencer Graves
Subject: Paste and namespace

Have you considered:

 > poly1 <- 1
 > get("poly1")
[1] 1
 >

hth.  spencer graves

Fernando Henrique Ferraz Pereira da Rosa wrote:
>  Hi, my doubt is very simple. I'm sure I've seen someone using something
> like this before, but unfortunatelly my searches in the archives were useless.
>  Well, I have some objects called after a name that has a number attached to
> it,
>  varying. Let's say I have:
>  > ls
>    poly1 poly2 poly3 poly4 poly5 poly6 ...
>  
>  I would like to access these objects using a for(), in which I could do
> something like paste("poly",i,sep=''). For i = 4, for instance I get
>  > paste("poly",4,=sep'')
>  [1] "poly8"
>  Which is a string. What command should I use to 'access' the object named
> by this string, ir order to do some useful things, like changing its value?
> 
> Thank you,
> 
> --
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help