amr <- read.csv("amr_paraB_trends.csv")
so this table consists of 16 columns:
Continents (America, Asia, Europe)
Years (1965 1976 1981 1988 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021)
Streptomycin
Spectinomycin
Kanamycin
Ampicillin
Trimethoprim
Chloramphenicol
Ciprofloxacin_IR
Sulfisoxazole
Tetracycline
Nalidixic_acid
Colistin
Cefoxitin
Ceftriaxone
Lincomycin
than i converted this table to long df:
> amr$Years <- format(amr$Years, format = "%Y") > library(ggplot2) > library(tidyr) > df_long <- pivot_longer(amr, > cols = c(Streptomycin, Spectinomycin, Kanamycin, Ampicillin, Trimethoprim, Chloramphenicol, Ciprofloxacin_IR, Sulfisoxazole, Tetracycline, Nalidixic_acid, Colistin, Cefoxitin, Ceftriaxone, Lincomycin), > > values_to = "Isolates", > names_to = "Phenotypes") >
than I want to plot the trends of each phenotypes (Streptomycin, kanamycin and etc) over years for each continent.
> ##plot > ggplot(df_long, aes(x = Years, y = Isolates, color = Phenotypes, linetype = Continents)) + > geom_line(size = 0.7) + > ggtitle("Trend of amr over years") + > xlab("Year") + > ylab("No of isolates) + > #x_continuous(breaks = seq(1975, 2022, by = 1)) + > theme_minimal()
but this is not producing trend lines the graph is empty.
can anyone helps?