Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
dplyr ggplot plotly中的交互式绘图R_R_Ggplot2_Dplyr_R Plotly_Ggplotly - Fatal编程技术网

dplyr ggplot plotly中的交互式绘图R

dplyr ggplot plotly中的交互式绘图R,r,ggplot2,dplyr,r-plotly,ggplotly,R,Ggplot2,Dplyr,R Plotly,Ggplotly,我想根据我创建的dplyr管道创建一个交互式图表。我不完全确定这是否可行,但如果成功的话,那将是非常令人惊讶的。 这是密码。我基本上希望有一个下拉菜单,可以根据可用的唯一选项(注释掉)过滤rxid。 如果可能的话,我想避免使用shiny,但是如果需要的话,我想可以使用shiny drugname <- c('cipro', 'moxi','tazo') lhoabx %>% #filter (rxid %in% 'drugname' ) %>% (d

我想根据我创建的
dplyr
管道创建一个交互式图表。我不完全确定这是否可行,但如果成功的话,那将是非常令人惊讶的。 这是密码。我基本上希望有一个下拉菜单,可以根据可用的唯一选项(注释掉)过滤
rxid
。 如果可能的话,我想避免使用shiny,但是如果需要的话,我想可以使用shiny

    drugname <- c('cipro', 'moxi','tazo')
    lhoabx %>%
      #filter (rxid %in% 'drugname' ) %>% (drop down menu here?)
      group_by (locationid, month) %>%
      summarise (totaldot = sum(as.numeric(dot))) %>%
      right_join(pdays.summary, by = c('locationid', 'month')) %>%
      mutate (totaldot = case_when( is.na(totaldot) ~ 0
                                    ,TRUE ~ totaldot )) %>%
      mutate(dot1000 = totaldot/totalpdays * 1000) %>%
      ggplot (., aes(x = month, y = dot1000)) + 
      geom_line(aes(linetype = locationid)) 
drugname%
#过滤器(rxid%在%'drugname')%%>%(下拉菜单在这里?)
分组依据(地点ID,月份)%>%
汇总(总计点=总和(作为数字点))%>%
右键连接(pdays.summary,by=c('locationid','month'))%>%
当(is.na(totaldot)~0时突变(totaldot=case_
,TRUE~totaldot))%>%
突变(dot1000=totaldot/totalpdays*1000)%>%
ggplot(,aes(x=month,y=dot1000))+
几何图形线(aes(线型=位置ID))

您打算如何在不使用Shiny的情况下使图表具有交互性?是的,我想知道是否有一种方法可以在不使用Shiny的情况下实现这一点。希望与使用powerbitry的人分享这个“操纵”软件包。如果您使用plotly: