小编sdh*_*aus的帖子

闪亮的应用程序 - googleAnalyticsR导致flexdashboard仪表失去颜色

我的Shiny App有问题,特别是flexdashboard仪表googleAnalyticsR之间的问题.

当我最初使用预先填充的值加载应用程序时,仪表会显示相应的颜色. 在此输入图像描述

但是,在我登录并为Google Analytics(googleAuthR)创建授权令牌后,标尺栏上的颜色立即消失. 在此输入图像描述

下面是我正在处理的应用程序的剥离版本,它展示了这个问题.我尝试了多种不同的加载包的方法(比如这个,这个),但我没有运气.Chrome或R控制台中没有错误,因此我不确定为什么Google身份验证会导致图形丢失颜色,而不会丢失值.

library(shiny)
library(shinydashboard)
library(googleAnalyticsR)
library(googleAuthR)
library(flexdashboard)


ui <- shinyUI(dashboardPage(

  dashboardHeader(title = "Test"),
  dashboardSidebar(
    sidebarMenu(
      menuItem("Test", tabName = "Test", icon = icon("dashboard"))
    )
  ),
  dashboardBody(
    tabItems(
      tabItem(tabName = "Test",
              fluidRow(

                titlePanel("Test"),
                sidebarPanel(
                  helpText("Start by logging in to your Google Analytics account."),
                  googleAuthUI("login"),
                  br()
                ),
                mainPanel(
                  column( width = 4,
                          flexdashboard::gaugeOutput("outputBox1")
                  ),column( width = 4,
                            flexdashboard::gaugeOutput("outputBox2")
                  ),column( width = 4,
                            flexdashboard::gaugeOutput("outputBox3")
                  )
                )
              ))
      ))))


server <- shinyServer(function(input, output, …
Run Code Online (Sandbox Code Playgroud)

r google-analytics-api shiny flexdashboard

7
推荐指数
0
解决办法
434
查看次数

将一列添加到同一 DataFrame 中的列的末尾

我目前有一个数据框,是我使用 Beautiful Soup 从互联网上抓取的。然而,它的设置是网格化的,而不是一个连续的列表。就像行的月份和列的年份一样。

但是,我试图使它成为一个连续的列,因为这些数据将与其他数据(即出生与死亡)进行对比。

我目前拥有的 df 示例如下,

      2010        2011      2013     2014
Jan  1.474071 -0.064034  0.781836 -1.282782
Feb -1.071357  0.441153  0.583787  2.353925
Mar  0.221471 -0.744471  1.729689  0.758527
Apr -0.964980 -0.845696  1.846883 -1.340896
May -1.328865  1.682706  0.888782 -1.717693
Jun  0.228440  0.901805  0.520260  1.171216
Jul -1.197071 -1.066969 -0.858447 -0.303421
Aug  0.306996 -0.028665  1.574159  0.384316
Sep -0.014805 -0.284319 -1.461665  0.650776
Oct  1.588931  0.476720 -0.242861  0.473424
Nov -0.014805 -0.284319 -1.461665  0.650776
Dec  0.964980 -0.845696  1.846883 -1.340896
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试追加(使用忽略索引)时,我得到

 df[["2010"]].append(df[["2011"]], ignore_index=True)

  00    1.474071    NaN  
  01   -1.071357 …
Run Code Online (Sandbox Code Playgroud)

python pandas

3
推荐指数
1
解决办法
2566
查看次数

标签 统计

flexdashboard ×1

google-analytics-api ×1

pandas ×1

python ×1

r ×1

shiny ×1