Hi, i'm quite new to R and need your help.
I have an excel sheet with measurements I have taken throughout several week. I have one measurement per week and would like to plot a line graph to visualize the development. In Excel i have one column for the exact date the measurements were taken and one with the numbers. The dates are in dd.mm.yyyy format and it seems like R recognizes it as dates.
Now, whenever i try to plot it the dates on the x-axis are not the ones i have in my excel sheet. When I change the dates into strings i get this comment:
geom_line()`: Each group consists of only one observation.
i Do you need to adjust the group aesthetic?
The graph now has the correct dates but it doesn't have any data in it.
When I try the data_df$Date <- as.Date(data_df$Date) it doesn't change anything, it shows the wrong dates still.
This is the code I've used so far:
library(ggplot2)
library(readxl)
Read the Excel data
library(readxl)
Algae_analysis <- read_excel("Bachelorarbeit/Datenanalyse/Algae_analysis.xlsx",
sheet = "Spots", range = "A19:B27")
View(Algae_analysis)
Convert Week column to string format
Algae_analysis$Week <- as.character(Algae_analysis$Week)
Create a line plot
line_plot <- ggplot(Algae_analysis, aes(x = Week, y = total conc.
)) +
geom_line() +
labs(x = "Week", y = "Total Concentration") +
theme_minimal()
Display the line plot
print(line_plot)
I would appreciate if anyone can help me out here as I need this for my thesis. Feel free to ask if anything is unclear.