plot different columns in one graph R

Refresh

March 2019

Views

3 time

0

My sample data :

structure(list(year = c(2018, 2018, 2018, 2018, 2019, 2019), 
    month = c(9, 10, 11, 12, 1, 2), pred1 = c(-6.63356483810535, 
    -6.50968293287978, -1.54767782423655, -1.47812226859267, 
    -1.36788275407234, -1.28168637109063), pred2 = c(-1.42361872090391, 
    -1.3982815502715, -1.1409241475472, -1.1331066959139, -1.12562914109629, 
    -1.11814749991547)), row.names = c(NA, -6L), class = c("tbl_df", 
"tbl", "data.frame"))

I would like to have month on x-axis and year on y-axis and draw line graph for both pred1 and pred2 and compare graphically. I appreciate help in doing R

0 answers