2
Hello, I’m trying to plot a bar graph geom_bar
, where X corresponds to the days of the month, in this case February, and y refers to the value of two variables v1 e v2
for the day in mode position = "dodge"
. I studied, saw that x needs to be a factor/date and the other numerics, so I found quite confusing the explanations on sites and the examples taken in the stack in my head seemed to me quite specific. I would like to understand if possible the logic of this Plot, I will leave the data for help and example.
data via dput:
structure(list(dia = structure(1:28, .Label = c("01/02/2018",
"02/02/2018", "03/02/2018", "04/02/2018", "05/02/2018", "06/02/2018",
"07/02/2018", "08/02/2018", "09/02/2018", "10/02/2018", "11/02/2018",
"12/02/2018", "13/02/2018", "14/02/2018", "15/02/2018", "16/02/2018",
"17/02/2018", "18/02/2018", "19/02/2018", "20/02/2018", "21/02/2018",
"22/02/2018", "23/02/2018", "24/02/2018", "25/02/2018", "26/02/2018",
"27/02/2018", "28/02/2018"), class = "factor"), v1 = structure(c(3L,
12L, 22L, 21L, 9L, 5L, 2L, 4L, 7L, 25L, 19L, 25L, 20L, 1L, 13L,
8L, 23L, 24L, 17L, 15L, 11L, 10L, 6L, 27L, 26L, 18L, 16L, 14L
), .Label = c("1.014", "1.382", "1.436", "1.462", "1.470", "1.479",
"1.496", "1.572", "1.618", "1.619", "1.682", "1.692", "1.791",
"1.839", "1.860", "1.876", "1.883", "1.943", "461", "511", "589",
"662", "695", "735", "774", "791", "873"), class = "factor"),
v2 = structure(c(2L, 9L, 21L, 20L, 11L, 5L, 1L, 3L, 4L, 25L,
18L, 24L, 19L, 28L, 12L, 7L, 23L, 22L, 16L, 14L, 10L, 8L,
6L, 27L, 26L, 17L, 15L, 13L), .Label = c("1.276", "1.301",
"1.328", "1.344", "1.348", "1.358", "1.460", "1.468", "1.499",
"1.515", "1.538", "1.677", "1.708", "1.741", "1.749", "1.755",
"1.788", "429", "482", "535", "575", "646", "658", "697",
"744", "752", "778", "924"), class = "factor")), .Names = c("dia",
"v1", "v2"), row.names = c(NA, -28L), class = "data.frame")
I’m sorry, I didn’t post a Plot or code, because they were all very unsatisfying.
I’m finding the values of
v1
andv2
strangers. They appear as factors for me. Is that correct? Or should they be numerical values? And if they are numerical values, 1,276 means "1 comma two hundred and seventy-six" or it means "one thousand two hundred and seventy-six"?– Marcus Nunes
@Thanks for noticing, I didn’t have.
– Rui Barradas
@Macus Nunes and @Macrusnunes, I spoke very lazily in the text,
v1
andv2
are numerical yes, are na 3° phrase "I studied, saw that x needs to be a factor/date and the other numerical..." .– macchi