On Monday, September 29, 2008 1:59, Dimitris Rizopoulos wrote:
> On Monday, September 29, 2008 1:26, milton ruser wrote:
> > ...I have a data.frame like...
> >place<-c("place1", "place2", "place3", "place4", "place5")
> >population<-c(100,200,300,50,30)
> >my.df<-data.frame(cbi
try this:
place <- c("place1", "place2", "place3", "place4", "place5")
population <- c(100, 200, 300, 50, 30)
my.df <- data.frame(place, population)
my.df[rep(row.names(my.df), my.df$population), ]
I hope it helps.
Best,
Dimitris
milton ruser wrote:
Dear all,
I have a data.frame like the
Try this:
my.df <- data.frame(Place = rep(place, population), Population =
rep(population, population))
On Mon, Sep 29, 2008 at 2:26 PM, milton ruser <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I have a data.frame like the sample below, and I would
> like to expand my data.frame using "population"
Dear all,
I have a data.frame like the sample below, and I would
like to expand my data.frame using "population" variable.
So, for each line of my data.frame I would like that
the new data.frame have many rows as the population collumn.
place<-c("place1", "place2", "place3", "place4", "place5")
p
4 matches
Mail list logo