小编MBn*_*nnn的帖子

使用R Shiny一键下载多个csv文件(downloadhandler)

*嗨,我正在尝试从一个唯一的excel文件中下载多个csv文件。我想从Excel文件中下载(仅使用一个下载按钮)差异表。我不明白为什么for()循环不起作用,并且我看不到该怎么办?如果有人知道..

关键是要下载不同的csv文件,这些文件位于“ wb”列表中(wb [1],wb [2] ...)谢谢。这是我的代码,例如,处理第三张纸的代码(对不起我的英语不好):ui:

library(readxl)
library(shiny)
library(XLConnect)
fluidPage(
titlePanel("Export onglets en CSV"),
  sidebarLayout(
    sidebarPanel(
      fileInput('fichier1','Choisissez votre fichier excel :',
                accept = ".xlsx"),
      fluidPage(
    fluidRow(
      column(width = 12,
             numericInput("sheet","Indiquez l'onglet à afficher :",min = 1, value = 1),
             tags$hr(),
             textInput('text',"Indiquez le nom des fichiers :"),
             tags$hr(),
             h4("Pour télécharger les fichiers .csv :"),
             downloadButton("download","Télécharger")
             )

    )
  )),
mainPanel(
  tabsetPanel(
    tabPanel('Importation',
             h4("Fichier de base:"),
             dataTableOutput("contents"))
      )
    )
  )
)
Run Code Online (Sandbox Code Playgroud)

服务器:

function(input,output){

  #Création data :
  data <- reactive({
    inFile<- input$fichier1
    if (is.null(inFile)){ …
Run Code Online (Sandbox Code Playgroud)

csv r shiny

5
推荐指数
1
解决办法
3271
查看次数

如何在ggplot2中的geom_bar()上放置标签(没有手动y_position)

我,这是我的问题.

我想用ggplot2创建一个geom_bar,条形图上有标签.

这是一个可重现的例子和生成的图:

prop = c(rep("A",2),rep("B",2),rep("C",2))
n = c(rep(29,2),rep(63,2),rep(25,2))
var = c(rep(c("sortant","entrant"),3))
value = c(10,19,43,20,10,15)
mydata = data.frame(cbind(prop,n,var,value))

> mydata
prop  n     var value
   A 29 sortant    10
   A 29 entrant    19
   B 63 sortant    43
   B 63 entrant    20
   C 25 sortant    10
   C 25 entrant    15

mydata$n = as.integer(as.character(mydata$n))
mydata$value = as.integer(as.character(mydata$value))

ggplot(data = mydata)+aes(x = prop, y = value, fill = var)+geom_bar(stat = 'identity')+
  scale_fill_brewer(palette = 'Paired')+geom_text(aes(label = value))
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

我想制作这个情节,而不是手动创建"y_pos"(如下面的例子),因为我每周都要用不同的数据制作这个情节.

mydata2 = mydata
mydata2$y_pos = c(7,20,20,50,7,17)

>mydata2 …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

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

标签 统计

r ×2

csv ×1

ggplot2 ×1

shiny ×1