I discovered that if ggplot is the last thing in a function, then calling the function will result in ggplot creating a plot as expected.
But if ggplot is not the last thing in a function -- say it is followed by an assignment (like x <- t) or a return statement (like return(x)) then ggplot will not create a plot.
What is the work around for this?
P.S. please throw in a comment explaining how to create an inline grey background used to indicate code :-)