Network3D и RMarkdown: SankeyDiagram не отображается в (вязать) HTML-файл (локальный и rBrowser) - PullRequest
0 голосов
/ 17 декабря 2018

Как видно из заголовка, я не могу создать диаграмму Санки в моем html-файле (knit RMarkdown).График генерируется в консоли R, но даже не в Rbrowser после вязки.

Вот код:

sankeyNetwork(Links = sank$links, Nodes = sank$nodes, Source = "source",
          Target = "target", Value = "value", NodeID = "name",
          units = "Nb patients", fontSize = 14, nodeWidth = 30)

и проблеск данных:

> lapply(sank,head)
$`links`
  Source variable value source target
1 Adulte venuLUIM  6445      0      2
2 Enfant venuLUIM  5248      1      2
3 Adulte  venuASS   324      0      3
4 Enfant  venuASS   373      1      3
5 Adulte    venuG  3069      0      4
6 Enfant    venuG  2398      1      4

$nodes
         name
1      Adulte
2      Enfant
3 De lui même
4 Association
5 Généraliste
6    Pédiatre

Вот мои варианты вязания:

options(max.print="75")
opts_chunk$set(echo=FALSE,
             cache=TRUE,
           prompt=FALSE,
           tidy=TRUE,
           comment=NA,
           message=FALSE,
           warning=FALSE)
opts_knit$set(width=75)

Упрощенное изложение моего документа Rmd: --- title: "AnDDi-Rares: 10 лет CEMARA" дата: "r Sys.Date()" вывод: rmdformats ::Материал: основной момент: Кейт ---

            ```{r knitr_init, echo=FALSE, cache=FALSE}
            suppressWarnings(suppressPackageStartupMessages(library(knitr)))
            suppressWarnings(suppressPackageStartupMessages(library(rmdformats)))
            source("multiplot.r")

            ## Global options
            options(max.print="75")
            opts_chunk$set(echo=FALSE,
                             cache=TRUE,
                           prompt=FALSE,
                           tidy=TRUE,
                           comment=NA,
                           message=FALSE,
                           warning=FALSE,out.width = '60%')
            opts_knit$set(width=75)

            suppressWarnings(suppressPackageStartupMessages(require(RJDBC)))
            suppressWarnings(suppressPackageStartupMessages(require(lubridate)))
            suppressWarnings(suppressPackageStartupMessages(require(rgdal)))
            suppressWarnings(suppressPackageStartupMessages(require(maptools)))
            suppressWarnings(suppressPackageStartupMessages(require(RColorBrewer)))
            suppressWarnings(suppressPackageStartupMessages(require(ggplot2)))
            suppressWarnings(suppressPackageStartupMessages(require(wordcloud)))
            suppressWarnings(suppressPackageStartupMessages(require(sjPlot)))
            suppressWarnings(suppressPackageStartupMessages(require(sqldf)))
            suppressWarnings(suppressPackageStartupMessages(require(plyr)))
            suppressWarnings(suppressPackageStartupMessages(require(dplyr)))
            suppressWarnings(suppressPackageStartupMessages(require(rgeos)))
            suppressWarnings(suppressPackageStartupMessages(require(rworldmap)))
            suppressWarnings(suppressPackageStartupMessages(require(scales)))
            suppressWarnings(suppressPackageStartupMessages(require(grid)))
            suppressWarnings(suppressPackageStartupMessages(require(gridExtra)))
            suppressWarnings(suppressPackageStartupMessages(require(igraph)))
            suppressWarnings(suppressPackageStartupMessages(require(networkD3)))
            suppressWarnings(suppressPackageStartupMessages(require(sjplot)))


            ```

            ## 4.2. Patients administrative information (number, age, sex)
            ### Figure 1: Number of patients in database

            ```{r nb_Patients_administrative_information}

            # 4.2.  Patients administrative information (number, age, sex)----
            ```

            ### Figure 2: Age pyramid

            ```{r pyramid_age}

            ```

            ### Figure 3: Through-time analysis of the sex ratio

            ```{r sex_ratio}

            ```


            ## 4.3. Diagnosis

            ```{r diagnosis}

            ```

            ### RD coverage in France (`r length(unique(tab_final_lib$num_orpha)) ` diseases)
            ####    Most frequent  

            ```{r top20-diag}

            ```

            #### Less frequent

            ```{r bottom20-diag}

            ```

            ### Patients counts, prevalence by group, AnDDI-RARE vs. whole CEMARA and Orphanet

            ```{r tableau_full}

            ```


            ## 4.4. Activities

            ```{r Activities}

            ```


            # 5.    A large cohort experience
            ## 5.1. Data submitters
            ### o   Number of users of CEMARA : A through time analyse

            ```{r Data_submitters}


            ```


            # 6.    Care organization
            ## Access to expert consultations:
            ### How is the patient oriented to the experts?

            ```{r care_orga}

            URL <- paste0('https://cdn.rawgit.com/christophergandrud/networkD3/',
                          'master/JSONdata/energy.json')
            energy <- jsonlite::fromJSON(URL)

            # Plot
            sankeyNetwork(Links = energy$links, Nodes = energy$nodes, Source = 'source',
                         Target = 'target', Value = 'value', NodeID = 'name',
                         units = 'TWh', fontSize = 12, nodeWidth = 30)
            ```

И информация о моей сессии:

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252     LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                   LC_TIME=French_France.1252    

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] bindrcpp_0.2.2     dplyr_0.7.7        networkD3_0.4      igraph_1.2.2      
[5] gridExtra_2.3      scales_1.0.0       rworldmap_1.3-6    rgeos_0.4-1       
[9] plyr_1.8.4         sqldf_0.4-11       RSQLite_2.1.1      gsubfn_0.7        
[13] proto_1.0.0        sjPlot_2.6.1       wordcloud_2.6      ggplot2_3.1.0     
[17] RColorBrewer_1.1-2 maptools_0.9-4     rgdal_1.3-6        sp_1.3-1          
[21] lubridate_1.7.4    RJDBC_0.2-7.1      rJava_0.9-10       DBI_1.0.0         
[25] rmdformats_0.3.3   knitr_1.20
...