我定义了一个名为response的变量.
response<-"job"
当我直接在facet_wrap()中指定变量时
例如
ggplot(data,aes(job,fill=class )) + geom_bar() +facet_wrap(~job)
它给出了所需的情节
但是当我在facet_wrap()中指定响应变量时
ggplot(data,aes(job,fill=reponse))+ geom_bar() + facet_wrap(~get(paste(response)))
我犯了一个错误
At least one layer must contain all variables used for facetting
有没有办法让facet_wrap从响应变量中接受变量名,而不是直接在其中写入变量名