[R] Updating an object
Uwe Ligges
ligges at statistik.tu-dortmund.de
Tue Jul 21 14:26:09 CEST 2009
megh wrote:
> Let say, I have an arbitrary vector :
>
> i=1
> assign(paste("dat",i,sep=""), rnorm(5))
>
> Now I want to update that "dat1" vector by ommiting last 2 elements i.e.
>
> dat1 = dat1[c(1:3)]
>
> However here my problem is, as "dat1" depends on another variable "i", I
> cannot use above syntax directly. I want to automate above syntax such that
> I can run this for any "i". Is there any way?
Yes, but actually you want a list "dat" that contains vectors at
positions i.
Uwe Ligges
> Thanks
>
>
More information about the R-help
mailing list