Flexdashboard随用户输入打开新选项卡

时间:2019-04-30 06:03:18

标签: shiny plotly flexdashboard reprex

我想寻求有关使用Plotly和Shiny的Flexdashboard的帮助。现在唯一的是,该应用程序像没有明天一样扔掉了浏览器选项卡。对于用户的每个无功输入,该应用都会打开一个新标签,并在其中产生正确的输出。

我注意到Flexdashboard,Plotly和Shiny都对我有效。问题似乎在他们的组合中出现。

我将不胜感激一些建议。 The reproducible .Rmd script may be found on Github 。使用以下代码在大约两分钟内部署了它:

install.packages('arules')
install.packages('car')
install.packages('contrast')
install.packages('corpcor')
install.packages('doBy')
install.packages('dplyr')
install.packages('flexdashboard')
install.packages('gdata')
install.packages('ggplot2')
install.packages('ggrepel')
install.packages('GPArotation')
install.packages('gtools')
install.packages('Hmisc')
install.packages('irr')
install.packages('lattice')
install.packages('leaflet')
install.packages('ltm')
install.packages('MASS')
install.packages('pastecs')
install.packages('plotly')
install.packages('plyr')
install.packages('png')
install.packages('psych')
install.packages('qpcR')
install.packages('QuantPsyc')
install.packages('RColorBrewer')
install.packages('RCurl')
install.packages('reshape')
install.packages('Rmisc')
install.packages('rsconnect')
install.packages('scales')
install.packages('shiny')
install.packages('tibble')

library(arules)
library(car)
library(contrast)
library(corpcor)
library(doBy)
library(dplyr)
library(flexdashboard)
library(gdata)
library(ggplot2)
library(ggrepel)
library(GPArotation)
library(gtools)
library(Hmisc)
library(irr)
library(lattice)
library(leaflet)
library(ltm)
library(MASS)
library(pastecs)
library(plotly)
library(plyr)
library(png)
library(psych)
library(qpcR)
library(QuantPsyc)
library(RColorBrewer)
library(RCurl)
library(reshape)
library(Rmisc)
library(rsconnect)
library(scales)
library(shiny)
library(tibble)

rmarkdown::run('complete norms flex.rmd')

下面是我得到的输出(对我来说并没有太多启示)。

> rmarkdown::run('complete norms flex.rmd')
Loading required package: shiny

Listening on http://127.0.0.1:6295



processing file: complete_norms_flex.rmd

  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |.....                                                            |   8%
  ordinary text without R code


  |                                                                       
  |..........                                                       |  15%
label: global (with options) 
List of 1
 $ include: logi FALSE

Loading required package: MASS
Loading required package: msm
Loading required package: polycor

Attaching package: 'psych'

The following object is masked from 'package:ltm':

    factor.scores

The following object is masked from 'package:polycor':

    polyserial

Loading required package: carData

Attaching package: 'car'

The following object is masked from 'package:psych':

    logit

Loading required package: rms
Loading required package: Hmisc
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2
RStudio Community is a great place to get help:
https://community.rstudio.com/c/tidyverse.

Attaching package: 'ggplot2'

The following objects are masked from 'package:psych':

    %+%, alpha


Attaching package: 'Hmisc'

The following object is masked from 'package:psych':

    describe

The following objects are masked from 'package:base':

    format.pval, units

Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve


Attaching package: 'rms'

The following object is masked from 'package:Hmisc':

    plotp

The following objects are masked from 'package:car':

    Predict, vif

The following object is masked from 'package:shiny':

    validate


Attaching package: 'pastecs'

The following object is masked from 'package:rms':

    specs


Attaching package: 'scales'

The following objects are masked from 'package:psych':

    alpha, rescale

Loading required package: Matrix

Attaching package: 'Matrix'

The following object is masked from 'package:reshape':

    expand


Attaching package: 'arules'

The following object is masked from 'package:car':

    recode

The following objects are masked from 'package:base':

    abbreviate, write


Attaching package: 'plyr'

The following objects are masked from 'package:reshape':

    rename, round_any

The following objects are masked from 'package:Hmisc':

    is.discrete, summarize


Attaching package: 'magrittr'

The following object is masked from 'package:pastecs':

    extract


Attaching package: 'dplyr'

The following objects are masked from 'package:plyr':

    arrange, count, desc, failwith, id, mutate, rename, summarise,
    summarize

The following objects are masked from 'package:arules':

    intersect, recode, setdiff, setequal, union

The following object is masked from 'package:reshape':

    rename

The following objects are masked from 'package:pastecs':

    first, last

The following objects are masked from 'package:Hmisc':

    src, summarize

The following object is masked from 'package:car':

    recode

The following object is masked from 'package:MASS':

    select

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union


Attaching package: 'rlang'

The following object is masked from 'package:magrittr':

    set_names

gdata: Unable to locate valid perl interpreter
gdata: 
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location
gdata: of a valid perl intrpreter.
gdata: 
gdata: (To avoid display of this message in the future, please
gdata: ensure perl is installed and available on the executable
gdata: search path.)
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.

gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.

gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.

Attaching package: 'gdata'

The following objects are masked from 'package:rlang':

    env, ll

The following objects are masked from 'package:dplyr':

    combine, first, last

The following objects are masked from 'package:pastecs':

    first, last

The following object is masked from 'package:stats':

    nobs

The following object is masked from 'package:utils':

    object.size

The following object is masked from 'package:base':

    startsWith

Loading required package: boot

Attaching package: 'boot'

The following object is masked from 'package:survival':

    aml

The following object is masked from 'package:car':

    logit

The following object is masked from 'package:psych':

    logit

The following object is masked from 'package:lattice':

    melanoma

The following object is masked from 'package:msm':

    cav


Attaching package: 'QuantPsyc'

The following object is masked from 'package:Matrix':

    norm

The following object is masked from 'package:SparseM':

    norm

The following object is masked from 'package:base':

    norm

Loading required package: minpack.lm
Loading required package: rgl
Loading required package: robustbase

Attaching package: 'robustbase'

The following object is masked from 'package:boot':

    salinity

The following object is masked from 'package:survival':

    heart

The following object is masked from 'package:psych':

    cushny


Attaching package: 'gtools'

The following objects are masked from 'package:boot':

    inv.logit, logit

The following object is masked from 'package:rlang':

    chr

The following object is masked from 'package:car':

    logit

The following object is masked from 'package:psych':

    logit

Loading required package: bitops

Attaching package: 'rsconnect'

The following object is masked from 'package:shiny':

    serverInfo


Attaching package: 'plotly'

The following objects are masked from 'package:plyr':

    arrange, mutate, rename, summarise

The following object is masked from 'package:reshape':

    rename

The following object is masked from 'package:Hmisc':

    subplot

The following object is masked from 'package:ggplot2':

    last_plot

The following object is masked from 'package:MASS':

    select

The following object is masked from 'package:stats':

    filter

The following object is masked from 'package:graphics':

    layout

R was not square, finding R from data
R was not square, finding R from data

  |                                                                       
  |...............                                                  |  23%
  ordinary text without R code


  |                                                                       
  |....................                                             |  31%
label: unnamed-chunk-1

  |                                                                       
  |.........................                                        |  38%
  ordinary text without R code


  |                                                                       
  |..............................                                   |  46%
label: unnamed-chunk-2

  |                                                                       
  |...................................                              |  54%
  ordinary text without R code


  |                                                                       
  |........................................                         |  62%
label: unnamed-chunk-3

  |                                                                       
  |.............................................                    |  69%
  ordinary text without R code


  |                                                                       
  |..................................................               |  77%
label: unnamed-chunk-4

  |                                                                       
  |.......................................................          |  85%
  ordinary text without R code


  |                                                                       
  |............................................................     |  92%
label: unnamed-chunk-5 (with options) 
List of 3
 $ fig.width : num 5
 $ fig.height: num 5
 $ echo      : logi FALSE


  |                                                                       
  |.................................................................| 100%
  ordinary text without R code


output file: C:/Users/Pablo/AppData/Local/Temp/RtmpuWjXVZ/complete_norms_flex.knit.md

"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS "C:/Users/Pablo/AppData/Local/Temp/RtmpuWjXVZ/complete_norms_flex.utf8.md" --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pandoc1de01a9e76fc.html --smart --email-obfuscation none --standalone --section-divs --template "C:\Users\Pablo\Documents\R\win-library\3.5\flexdashboard\rmarkdown\templates\flex_dashboard\resources\default.html" --include-in-header "C:\Users\Pablo\AppData\Local\Temp\RtmpuWjXVZ\rmarkdown-str1de074483ff7.html" --id-prefix section- --variable "theme:cosmo" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\Pablo\AppData\Local\Temp\RtmpuWjXVZ\file1de02c6f317chtml" --include-before-body "C:\Users\Pablo\AppData\Local\Temp\RtmpuWjXVZ\file1de0258b6988.html" --include-after-body "C:\Users\Pablo\AppData\Local\Temp\RtmpuWjXVZ\file1de04c9e1cbf.html" --highlight-style pygments --include-before-body "C:\Users\Pablo\AppData\Local\Temp\RtmpuWjXVZ\file1de0220034f3.html" --include-after-body "C:\Users\Pablo\AppData\Local\Temp\RtmpuWjXVZ\file1de013ca2efd.html" 

Output created: C:/Users/Pablo/AppData/Local/Temp/RtmpuWjXVZ/file1de059b61073.html

我希望仪表板保留在一个浏览器选项卡上,但它会自我繁殖。

非常感谢您。

1 个答案:

答案 0 :(得分:0)

只需使用renderPlotly()而不是renderPlot()。通过另外两个问题发现: