0

Starting from a csv file, i'm having problem to create a lineplot with the ggplot2 library.

the error is "geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?"

i'm tryng with the mutate function to get a line on the graph, but the variable Date is character and i need it to be numerical.

library(ggplot2)
library(dplyr)
dataset_room <- read.csv("dataset_room-temperature.csv")

ggplot (dataset_room, aes(x=Date, y=FrontLeft))+
  geom_point()+ 
  geom_line()
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
  • Does this answer your question? [ggplot2 line chart gives "geom\_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?"](https://stackoverflow.com/questions/27082601/ggplot2-line-chart-gives-geom-path-each-group-consist-of-only-one-observation) – Ronak Shah Jun 14 '21 at 04:44

1 Answers1

0

Try this in order to show geom_line: add group=1 to your aes

ggplot (dataset_room, aes(x=Date, y=FrontLeft, group=1))+
  geom_point()+ 
  geom_line()
TarJae
  • 72,363
  • 6
  • 19
  • 66