I want to draw this plot:
from these data. The beginning of the data:
x <- read.csv2(text=
"strategy;success;date
1;1;02.09.2007
1;0;4/19/2012
1;1;2/15/2013
1;0;3/17/2004
1;1;12.02.2004
2;1;7/28/2014
1;1;9/29/2003
1;1;04.02.2004
1;1;09.02.2004
1;1;12/21/2004
1;1;6/23/2005
1;1;7/26/2005
1;1;8/24/2005
1;1;12.08.2005
1;1;01.10.2006
1;1;1/27/2006
1;1;07.10.2006
1;1;8/31/2006
1;1;3/20/2007
1;1;4/26/2007
1;1;6/27/2007
1;1;6/26/2007
1;1;7/16/2007
1;1;08.07.2007
1;1;2/26/2008
1;1;03.05.2008
1;1;04.10.2008
1;1;
1;1;09.01.2008
1;1;10/15/2008
1;1;10/23/2008
1;1;12/31/2008
1;1;1/22/2009")
I want to select only data which have an 1 in column 1:
x_selected <- x[x[,1]=="1", ]
I realised that the column with the dates is the wrong class and very heterogenous:
class(x_selected[,3])
## "factor"
Then i wanted to change this ugly dates (not heterogenous) into dates, but I cant figure out how to adapt the dates? My best try failed:
for (i in 1:nrow(x_selected)){
x_selected[i,3] <- as.Date(x_selected[i,3], "%d/%m/%Y")
}
My next step would be to group the single dates into quarters:
for (i in 1:nrow(x_selected)) {
x_selected[i,3] <- round_date(x_selected[i, 3], unit = c("quarter"))
}
I haven't been able to get any further. :-(