[R] casting a character vector as an object

Rolf Turner r.turner at auckland.ac.nz
Tue Sep 16 22:21:56 CEST 2008


On 17/09/2008, at 7:48 AM, j daniel wrote:

>
> Greetings,
>
> I need to compare the ratios of vector sizes like this:
>
> length(object1) / length(object2)
>
> I have many vector objects to compare, so I would like to do it in  
> a loop.
> I created a loop like this:
>
>
> mat1 <- matrix()
>
> for (i in 1:6)
> {
>    for (j in 1:6)
>      {
>
>        mat1[i,j] <- length( paste("object",i,sep="")) /
> (paste("object",j,sep="") )
>
>      }
> }
>
>
> The loop does not work, however, because   paste 
> ("object",i,sep="")  creates
> a character vector of length 1.  Is there a way to cast this as an  
> object so
> that it can be evaluated in the loop?

	?get

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list