1

I am trying to use the undercase omega symbol in my R ggplot2 figure legend. I have attempted to use the function sub() to substitute the "w" in my data with the unicode character for undercase omega. However, when I print the vector or data frame w is replaced with "ω".

Example code:

taxa <- c('16w.1', '18w.2.3w6', '15')
count<- c(21, 23, 27)
microbe.data <- data.frame(taxa, count)
my_labels <- sub(pattern = "w", replacement = "\U03C9", x = microbe.data$taxa)

my outcome:

"16ω.1"     "18ω.2.3w6" "15"   

Has anyone else run into this issue, any advice?

Nathan Werth
  • 4,833
  • 16
  • 25
Rebecca
  • 21
  • 2

0 Answers0