-2

Code where trying to apply g + labs(y=expression(N_{s})) with the following error which does not make sense

g <- ggplot(datm, aes(variable, value, fill=gender)) + geom_bar(stat="identity", position = position_dodge()) + facet_grid(male.Nij ~ group) + xlab("Association type") + ggtitle("View")
#http://stackoverflow.com/a/17335258/54964
g + labs( y=expression(N_{s}) )

I get

Error: unexpected '{' in "g + labs( y=expression(N_{"
Execution halted

R: 3.3.2 backports
OS: Debian 8.5

Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697

1 Answers1

1

it it not {}

# if you want to use sbuscript, use []
p + labs( y=expression(N[s]) )
# or as is
p + labs( y=expression(N_~'{s}') )
mt1022
  • 16,834
  • 5
  • 48
  • 71