I try to create a multiple-line graph to compare three different countries. Here is my data list.
library(tidyverse)
tabl3 = tribble(
~timeperiod, ~China, ~USA, ~Vietnam,
"Q1_2020", 59683.16, 16027.11, 42.46,
"Q2_2020", 85788.56, 1428099, 301.53,
"Q3_2020", 88738.21, 5187437, 785.5,
"Q4_2020", 92259.62, 12146383, 1268.5,
"Q1_2021", 97132.93, 27002382, 2098.53,
"Q2_2021", 100003.2, 32735900, 6331.2,
"Q3_2021", 104605.7, 37638364, 329380.4,
"Q1_2022", 132851.8, 74322951, 3842187,
"Q2_2022", 753897.1, 82788872, 10567360
)
This is the code that I try to write
myplot <- ggplot(data = table3, aes(x=timeperiod, y=China, group=1))
myplot <- myplot + geom_line(aes(y = China))
myplot <- myplot + geom_line(aes(y = USA))
myplot <- myplot + geom_line(aes(y = Vietnam))
myplot <- myplot + theme_classic()
myplot <- myplot + scale_color_manual(name = "Variable", labels = c("China", "USA", "Vietnam"), values = c("red","blue","yellow"))
myplot
Here is my error message:
Error: Discrete value supplied to continuous scale