I have a dataframe organized as shown below.
The 'year' column data is classified as numerical, but the 'country' column data is classified as categorical (will this be problematic?).
I would like to be able to line plot a specific country's sales over time.
df <- read.table(header=TRUE,text='
Country Sales Year
USA 956 2018
USA 855 2017
UK 635 2018
UK 588 2017
')
If possible, I would like to create numerous plots in a single go. I am able to plot the sales data by year without filtering country using this code, but I used facet_wrap to isolate each plot by year. What I would really like to do is plot "year" on the x-axis and isolate each plot by country. Unfortunately, I do not have enough "karma" points to insert an image of the output picture.
ggplot(data = df,
aes(x = Country,
y = Sales,
col = Year)) +
geom_point() +
facet_wrap(~Year) +
theme(axis.title.x = element_blank(),
axis.text.x = element_blank(),
axis.ticks.x = element_blank())