[R] Help

Patrick Burns pburns at pburns.seanet.com
Sat Nov 12 09:36:56 CET 2011

You've been told how to do what you ask.
But I'm not convinced that you really
want to do what you asked.

It might be better to do whatever you
want with the data leaving it all in one
object.  There are many ways of doing that,
the 'by' function is one of them.

On 11/11/2011 20:24, Francesca wrote:
> Dear Contributors
> I would like to perform this operation using a loop, instead of repeating
> the same operation many times.
> The numbers from 1 to 4 related to different groups that are in the
> database and for which I have the same data.
>      x<-c(1,3,7)
> datiP1<- datiP[datiP$city ==1,x];
> datiP2<- datiP[datiP$city ==2,x];
> datiP3<- datiP[datiP$city ==3,x]
> datiP4<- datiP[datiP$city ==4,x];

Patrick Burns
pburns at pburns.seanet.com
twitter: @portfolioprobe
(home of 'Some hints for the R beginner'
and 'The R Inferno')

More information about the R-help mailing list