Hello All,
I am seeking some assistance.
In the example code below, you will find that I have filtered out HIV Positive cases and added in additional code to view positive cases throughout the year of 2019.
What I would like to do next is add an additional element and plot Hepatitis C rates along with it. Essentially I want to make a time series and show the Rates of Hepatitis C and HIV displaying two geom_lines on the graph, one for HIV and one for Hep C.
However, I am having trouble trying to figure out how to code in Positive Hepatitis C rates with it.
I am not sure if I do a group_by etc etc.
Below you will find the code I used to plot Positive HIV cases.
Aphirm_2019_HIV_Testing %>%
mutate(Session.Date = as.Date(Session.Date, format = "%m/%d/%Y"),
session_date_yearmon = as.yearmon(Session.Date)) %>%
select(session_date_yearmon, final_test_result_coded) %>%
filter(final_test_result_coded == "Positive")%>%
count(session_date_yearmon, final_test_result_coded) %>%
ggplot(aes(month(session_date_yearmon, label = TRUE), n, color = final_test_result_coded, group = final_test_result_coded))+
geom_line()+
geom_point()+
geom_text(aes(label = n), vjust = -0.5, color = "black")+
labs(color = "Test Result", x = "Months", y = "Frequency")
The data that I am using consists of over 30K rows and I just wanted to display the first 10 to maybe give someone an idea. I am using 3 columns of data and those are displayed in the data below.
Session.Date final_test_result_coded Hepatitis.C.Test.Result
1 1/2/2019 Negative Negative
2 1/2/2019 Negative
3 1/2/2019 Negative Negative
4 1/2/2019 Negative
5 1/2/2019 Negative Negative
6 1/2/2019 Negative
7 1/2/2019 Negative Negative
8 1/2/2019 Negative Negative
9 1/2/2019 Negative
10 1/2/2019 Negative Positive
Appreciate all of the help / guidance.
Thank you,