Hi @saurabh,
I can fix your column ordering question but couldn't get the "proportion" bar chart to work without first making an intermediate data.frame. Maybe someone else has a solution?
suppressPackageStartupMessages(library(tidyverse))
prostate_cleaned <- data.frame(
stringsAsFactors = FALSE,
ID = c(10,11,12,13,14,15,16,17,
18,19,20,21,22,23,24,25,26,27,28,29),
Rescan1 = c("Yes","No","No","No","No",
"No","No","No","No","No","No","No","Yes","No",
"No","No","Yes","No","No","No"))
# Your original graph with the bar position specified, and
# legend removed.
ggplot(prostate_cleaned, aes(x=Rescan1, fill=Rescan1)) +
geom_bar() +
scale_fill_manual(values = c("green", "red")) +
geom_text(stat= 'count', aes(label=..count.., vjust=1)) +
scale_x_discrete(limits = c("Yes", "No")) +
theme(legend.position = "none")

prostate_cleaned %>%
mutate(total = nrow(.)) %>%
group_by(Rescan1) %>%
summarise(tots = n(),
totals = mean(total),
prop = tots/sum(totals)) -> summary.df
ggplot(summary.df) +
aes(x=Rescan1, y=prop, fill=Rescan1) +
geom_col() +
scale_fill_manual(values = c("green", "red")) +
geom_text(aes(x=Rescan1, label=tots, vjust=1)) +
scale_x_discrete(limits = c("Yes", "No")) +
theme(legend.position = "none")

Created on 2021-07-01 by the reprex package (v2.0.0)
#--- BUT this doesn't work?? ------
ggplot(prostate_cleaned, aes(x=Rescan1, fill=Rescan1, y = ..prop.., group=factor(Rescan1))) +
geom_bar() +
scale_fill_manual(values = c("green", "red")) +
geom_text(stat= 'count', aes(label=..count.., vjust=1)) +
scale_x_discrete(limits = c("Yes", "No"))