I have a dataset of dates and stock returns. I am trying to create a line plot returns by semiannual periods.
I mutated my dates to semiannual periods using
dataTable <- dataTable %>% mutate(Semiannual = semester(Date, with_year = TRUE))
See a sample of my data along with the new Semiannual column created.
Date Return Semiannual
1 2014-11-30 163.07848 2014.2
2 2014-06-30 10.48201 2014.1
3 2014-03-31 110.00537 2014.1
4 2012-12-31 -95.01492 2012.2
5 2017-07-31 3.30668 2017.2
6 2012-10-31 -0.48359 2012.2
7 2015-12-31 -0.50400 2015.2
8 2016-06-30 974.87289 2016.1
9 2016-02-28 49.37500 2016.1
10 2017-01-31 1.62813 2017.1
This resulted in a table of values ending with .1 as the first semiannual period and values ending with .2 as the second semiannual period.
I will group the data by Semiannual period then plot it.
When I plot the data, the x axis is distorted. I have a huge data gap between 2012.2 and 2014.1.
Do you have any ideas on how to go about making this even? I thought about using 2012.0, 2012.5, 2013, etc.. but it tends to get confusing when I am looking at it later on. Is there any way that I could change my labels to "2011 S2", "2012 S1", "2012 S2", etc. (See, I already got confused translating it back to that)
My goal is to achieve a plot with an x-axis that looks similar to this:
Or even if it was 2012 S1, 2012 S2, just evenly distanced.
Any help would be much appreciated.
Thank you!