Questions about ggplot2 theme setting

copy the theme setting code in "R language practice" by hand. I don"t know why I always report an error. The code is as follows:

library(ggplot2)
data(Salaries, package="car")

mytheme<-(plot.title=element_text(face="bold.italic",size=14,color="brown",hjust=0.5),
          axis.title=element_text(face="bold.italic",size="10",color="brown"),
          axis.text=element_text(face="bold.italic",size="9",color="darkblue"),
          panel.background=element_rect(fill="white",color="darkblue"),
          panel.grid.major.y=elemnt_line(color="grey",linetype=1),
          panel.grid.minor.y=element_line(color="grey", linetype=2),
          panel.grid.minor.x=element_blank())



ggplot(Salaries, aes(x=rank,y=salary,fill=sex)) + 
  geom_boxplot() +
  labs(title="Salary by Rank and Sex",x="RANK",y="Salary") +
  mytheme

the error message is as follows:

> source("~/.active-rstudio-document")
Error in source("~/.active-rstudio-document") : 
  ~/.active-rstudio-document:18:86: unexpected ","
17: 
18: mytheme<-(plot.title=element_text(face="bold.italic",size=14,color="brown",hjust=0.5),
                                                                                         ^

there"s nothing wrong with the comma, it"s in English, what"s wrong with it, thank you!

Mar.01,2021

omitted that theme (), made a 2b error.

Menu