[R] move date-values from one line to several lines

Matthias Weber Matthias.Weber at fntsoftware.com
Tue Dec 2 16:29:26 CET 2014


Hello together,

i have a data.frame with date-values. What I want is a data.frame with a several lines for each date.

My current data.frame looks like this one:

ID     FROM         TO                REASON
1      2015-02-27   2015-02-28    Holiday
1      2015-03-15   2015-03-20    Illness
2      2015-05-20   2015-02-23    Holiday
2      2015-06-01   2015-06-03    Holiday
2      2015-07-01   2015-07-01    Illness

The result looks like this one:

ID   DATE           REASON
1    2015-02-27    Holiday
1    2015-02-28    Holiday
1    2015-03-15    Illness
1    2015-03-16    Illness
1    2015-03-17    Illness
1    2015-03-18    Illness
1    2015-03-19    Illness
1    2015-03-20    Illness
2    2015-05-20   Holiday
2    2015-05-21   Holiday
2    2015-05-22   Holiday
2    2015-05-23   Holiday
2    2015-06-01   Holiday
2    2015-06-02   Holiday
2    2015-06-02   Holiday
2    2015-07-01   Illness

Maybe anyone can help me, how I can do this.

Thank you.

Best regards.

Mat

________________________________
This e-mail may contain trade secrets, privileged, undisclosed or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.

Diese E-Mail kann Betriebs- oder Geschaeftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtuemlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfaeltigung oder Weitergabe der E-Mail ausdruecklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.

	[[alternative HTML version deleted]]



More information about the R-help mailing list