R 在ggplot中使用闪亮的输入值

R 在ggplot中使用闪亮的输入值,r,ggplot2,shiny,R,Ggplot2,Shiny,我试图用Shiny实现这3行代码,这是我想要的输出 install.packages("ggalt") library(ggalt) health <- read.csv("https://raw.githubusercontent.com/selva86/datasets/master/health.csv") health$Area <- factor(health$Area, levels=as.character(health$Area)) # did something

我试图用Shiny实现这3行代码,这是我想要的输出

install.packages("ggalt")
library(ggalt)

health <- read.csv("https://raw.githubusercontent.com/selva86/datasets/master/health.csv")
health$Area <- factor(health$Area, levels=as.character(health$Area)) # did something for graph 

ggplot(health, aes(x=pct_2013, xend=pct_2014, y=Area))+
    geom_dumbbell()
install.packages(“ggalt”)
图书馆(ggalt)

运行状况所需的绘图不会显示,因为您正在以不同的方式调用
ggplot
。在您的应用程序中,选定的列名是字符串:

ggplot(health, aes(x='pct_2013', xend='pct_2014', y='Area'))+
    geom_dumbbell()
aes
替换为
aes\u字符串
,它将正常工作

ggplot(health, aes_string(x='pct_2013', xend='pct_2014', y='Area'))+
       geom_dumbbell()
ggplot(health, aes_string(x='pct_2013', xend='pct_2014', y='Area'))+
       geom_dumbbell()