the first thing is...sorry for my English.
I have two differents objects: a factor and a numeric. I print a geom_point()
and geom_line()
with x=Year with trimester (As factor)
, and y=value (numeric)
.
I divide y
information into two factor levels, through group= a factor variable
.
Then, I have two lines. I need to print 3 vertical lines in the position which is the biggest difference between both lines, and the lessest too.
I have seen that I can make a line with geom_segment
or geom_line
. But I need the start and the end, so I need x
reference. But my x
is a factor, not a numeric.
So, what can I do?
I have this enter image description here
And I need something like this (page 3, first graphic):
https://riull.ull.es/xmlui/bitstream/handle/915/6574/A_08_%282017%29_07.pdf?sequence=1&isAllowed=y
And this is my data (first 20 lines) before I transform it with melt
function (by "Ambos.Sexos")
`
structure(list(AMBOS.SEXOS = structure(20:1, .Label = c("2014TII",
"2014TIII", "2014TIV", "2015TI", "2015TII", "2015TIII", "2015TIV",
"2016TI", "2016TII", "2016TIII", "2016TIV", "2017TI", "2017TII",
"2017TIII", "2017TIV", "2018TI", "2018TII", "2018TIII", "2018TIV",
"2019TI"), class = "factor"), Activos = structure(c(18L, 20L,
19L, 12L, 11L, 17L, 4L, 5L, 2L, 7L, 10L, 8L, 6L, 13L, 14L, 15L,
16L, 9L, 1L, 3L), .Label = c("1.086,16", "1.089,43", "1.091,95",
"1.094,48", "1.094,62", "1.097,06", "1.100,27", "1.100,74", "1.100,83",
"1.102,15", "1.107,86", "1.108,98", "1.110,40", "1.110,65", "1.110,78",
"1.114,98", "1.118,25", "1.130,20", "1.131,53", "1.141,58"), class = "factor"),
Ocupados = structure(c(18L, 20L, 19L, 17L, 16L, 15L, 14L,
13L, 8L, 12L, 11L, 7L, 9L, 10L, 6L, 5L, 4L, 3L, 1L, 2L), .Label = c("723,87",
"735,09", "758,67", "771,46", "774,24", "793,48", "799,91",
"809,66", "811,85", "813,34", "815,45", "826,28", "828,61",
"855,17", "871,81", "879,46", "886,57", "892,47", "909,26",
"913,36"), class = "factor")), row.names = c(NA, 20L), class = "data.frame")
`