solution) and DF1
> str(DF)
> str(DF1)
>
>
> Andrija
>
>
>
>
>
> On Thu, May 29, 2014 at 12:03 AM, Andrija Djurovic >wrote:
>
> > Hi. Here is one approach:
> >
> > x <- rep(c("A", "B", "C"), c(3,1,2))
>
("A", "B", "C"), c(3,1,2))
>> DF <- data.frame(x, stringsAsFactors=FALSE)
>> cbind(DF, new_c=c(lapply(rle(DF$x)[[1]], function(x) 1:x), recursive=T))
>>
>> Andrija
>>
>>
>> On Wed, May 28, 2014 at 10:46 PM, Marcos Santos
I have a "data frame" like this:
Category Observed_value A 100 A 130 A 140 B 90 C 80 D 120 D 130
I need to create an index column that show the number of the observation
for each category. I have three observations in the category A, one in
category B, one in category C and two in catego
3 matches
Mail list logo