[R] convert strings to object names

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Aug 19 16:40:08 CEST 2004


Gudrun Jonasdottir wrote:

> Dear R-Help list,
> 
> I have a problem with convertions of strings. I want to use the function
> "paste()" to create an object name and then use that character string to
> call on that object. So, for example:
> 
> dat99 <- matrix(rbind(1,1,2),3,3)
> no <- 99
> dat <- paste("dat",no,sep="")
> dat
> [1] "dat99"
> 
> What should I do to get the output

get(dat)

Uwe Ligges


> dat
>      [,1] [,2] [,3]
> [1,]    1    1    1
> [2,]    1    1    1
> [3,]    2    2    2
> 
> Cheers,
> Gudrun
> 
> 
>




More information about the R-help mailing list