Skip to content
Prev 386565 / 398502 Next

How to specify year-month-day for a plot

You left out some calls to c().  Note that
   (2,3,5)
is not valid syntax for making a vector of numbers; use
   c(2,3,5)
You also left out a comma and gave different lengths for day and value.
You also left out plus signs between the various components of your ggplot
expression.

Try
 data <- data.frame(
     day = as.Date(c("2020-02-15", "2020-03-10", "2020-05-04",
"2020-06-21", "2020-08-01", "2020-08-27", "2020-09-28", "2020-11-09",
"2020-12-11", "2020-12-12")),
     value = c(15.973, 18.832, 17.392, 14.774, 19.248, 14.913, 15.226,
14.338, 18.777, 19.652))

 p <- ggplot(data, aes(x=day, y=value))+
       geom_line()+
       xlab("X Label")
 p

On Sun, Dec 13, 2020 at 5:35 PM Gregory Coats via R-help <
r-help at r-project.org> wrote: