When replacing the legend with R language, the following occurs,The Chinese part is the fullname vector

geom_bar(aes(y=GDP,fill=Sector),stat = "identity")+
labs(title = "2018")+
xlab("Sector")+ylab("Value added")
p+scale_fill_discrete(lables = fullname)

Error in discrete_scale(aesthetics, "hue", hue_pal(h, c, l, h.start, direction), :
unused argument (lables = c("S01农林牧渔产品和服务", "S02煤炭采选产品", "S03石油和天然气开采产品", "S04金属矿采选产品", "S05非金属矿和其他矿采选产品", "S06食品和烟草", "S07纺织品", "S08纺织服装鞋帽皮革羽绒及其制品", "S09木材加工品和家具", "S10造纸印刷和文教体育用品", "S11石油、炼焦产品和核燃料加工品", "S12化学产品", "S13非金属矿物制品", "S14金属冶炼和压延加工品", "S15金属制品", "S16通用设备", "S17专用设备", "S18交通运输设备", "S19电气机械和器材", "S20通信设备、计算机和其他电子设备", "S21仪器仪表", "S22其他制造产品和废品废料",
"S23金属制品、机械和设备修理服务", "S24电力、热力的生产和供应", "S25燃气生产和供应", "S26水的生产和供应", "S27建筑", "S28批发和零售", "S29交通运输、仓储和邮政", "S30住宿和餐饮", "S31信息传输、软件和信息技术服务", "S32金融", "S33房地产", "S34租赁和商务服务", "S35研究和试验发展", "S36综合技术服务", "S37水利、环境和公共设施管理", "S38居民服务、修理和其他服务", "S39教育", "S40卫生和社会工作", "S41文化、体育和娱乐", "S42公共管理、社会保障和社会组织"))

Hi @lexxxxxiiiiiiilee,
Welcome to the RStudio Community Forum.

What happens if you correct the misspelling of "lables=" to "labels="?

Hope this helps.

It's really a stupid mistake.(≧ω≦)Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.