Plot multiple colums from datatable

I want to plot all columns from a data table. My data table has 100 columns and 5 rows. Each row is a date and each column is a different person. How could I do it? I've tried the following code, but it only plots the last register:

plot1 <- ggplot(data, aes(x = date))
for (i in 1:100){
plot1 <- plot1 + geom_line(aes(y = data[ , i]))}

Could anyone help me? Thanks

Convert the data into long format first:
Pivot data from wide to long — pivot_longer • tidyr (tidyverse.org)

Then use aes(colour = colname) or aes(group = colname) within ggplot().

2 Likes

Thank you so much martin