[R] Create a unique group id

2014-01-02 Thread Norbi Gurracho
I have a following sample data frame. How can I create a group id of column and b and to obtain column c? a b c 1 1 1 1 1 1 1 1 1 1 2 2 1 2 2 1 2 2 1 3 3 1 3 3 1 3 3 2 1 4 2 1

Re: [R] Create a unique group id

2014-01-02 Thread Norbi Gurracho
а1ааа 3ааа 3 а1ааа 3ааа 3 а2ааа 1ааа 4 а2ааа 1ааа 4 а2ааа 1ааа 4 а2ааа 2ааа 5 а2ааа 2ааа 5 а2ааа 2ааа 5 а2ааа 2ааа 5,sep=,header=TRUE)а а within(dat, d - as.numeric(factor(paste(a,b),labels=1:5))) A.K. On Thursday, January 2, 2014 8:27 AM, Norbi Gurracho kum

[R] Plot mortality data and show trend

2013-12-09 Thread Norbi Gurracho
I have a mortality data over many years and I wish to plot the data and also add some smoother to clearly highlight the trend. How could I do that in R with base graphics or ggplot? I have the following sample data: require(lubridate) mdate-seq(ymd('2000-01-01'),ymd('2010-12-31'), by = '1