[R] How to access to an created array with a cicle for

Sarah Goslee sarah.goslee at gmail.com
Thu May 5 22:17:05 CEST 2016


You can use get(), but a more R-like way is to make a list of these
matrices instead of 600 separate objects.

thismat <- get(paste(E,x,y,z,sep="_"))

Sarah

On Thu, May 5, 2016 at 12:06 PM, Catarina Silva
<bolseiro.raiz.csilva at thenavigatorcompany.com> wrote:
> Hi,
>
> I'm organizing one data base in array's (matrix of positions and for each
> position I have a vector with 5 variables). And I have approximately 600
> array's.
>
> To construct these array's I've used a for cicle and after construct the
> array I named it like: E_1_1_1.1, and I've done the same for the others
> array's, like: E_2_1_4, .
>
>
>
> After, I need to access these constructed array's to compare them. But when
> I try to call them, in a for cicle, like noquote(paste(E,x,y,z,sep="_")) or
> simply E_x_y_z (varying x, y and z) R assume the name of the array as a
> "string" but don't associate the name to the array object created.  How can
> I call the array created before with a for cicle varying the index's
> "x","y","z" ?
>
>
>
> Ty,
>
>
>
> Catarina Silva
>
>
>
>



More information about the R-help mailing list