here is yet another way:
> dta <- read.csv( text=
+ "key_column,begin_date,end_date
+ 123456,2013-01-01,2014-01-01
+ 123456,2013-07-01,2014-07-01
+ 789102,2012-03-01,2014-03-01
+ 789102,2015-02-01,2016-02-01
+ 789102,2015-02-06,2016-02-06
+ 789102,2015-02-28,2015-03-31
+ 789102,2015-04-30,20
Here is another way. Have not tested for large scale efficiency, but if you
convert dta to a data.table that might improve things.
library(dplyr)
dta <- read.csv( text=
"key_column,begin_date,end_date
123456,2013-01-01,2014-01-01
123456,2013-07-01,2014-07-01
789102,2012-03-01,2014-03-01
789102,20
Hi,
It's not as easy as I originally thought. Here is a revision with the
function beginEnd to get it done.
> date
key_column begin_dateend_date
1 123456 2013-01-01 2014-01-01
2 123456 2013-07-01 2014-07-01
3 789102 2012-03-01 2014-03-01
4 789102 2015-02-01 2016-02-01
Hi,
Here is an implemenation:
> date
key_column begin_dateend_date
1 123456 2013-01-01 2014-01-01
2 123456 2013-07-01 2014-07-01
3 789102 2012-03-01 2014-03-01
4 789102 2015-02-01 2016-02-01
5 789102 2015-02-06 2016-02-06
> y <- t(sapply(unique(date$key_column),
Hi,
I am trying to process a large dataset in R. The dataset contains the
following three columns:
key_column - a unique key identifier
begin_date - the start date of the active period
end_date - the end date of the active period
Example data is here:
key_column,begin_date,end_date
123456,201
5 matches
Mail list logo