当前位置: 首页 > news >正文

个人网站带论坛 备案网站建设百度推广

个人网站带论坛 备案,网站建设百度推广,正规的镇江网站建设,搭建服务器需要多少钱shiny 能快速把R程序以web app的形式提供出来,方便使用,降低技术使用门槛。 本文提供的示例:把空格分隔的txt文件转为逗号分隔的csv文件。 前置依赖:需要有R环境(v4.2.0),安装shiny包(v1.9.1)。括号内是我使用的版本…

shiny 能快速把R程序以web app的形式提供出来,方便使用,降低技术使用门槛。

本文提供的示例:把空格分隔的txt文件转为逗号分隔的csv文件。

前置依赖:需要有R环境(v4.2.0),安装shiny包(v1.9.1)。括号内是我使用的版本。

install.packages(“shiny”)

1.运行与效果

  • 文件名:script/app3/app.R
  • 运行: > shiny::runApp(“script/app3/”)
  • 关闭:关闭浏览器。
  1. 左上角:上传文件,
  2. 右侧:预览效果
  3. 右下角:下载csv文件
    在这里插入图片描述

2.文件内容

script/app3/app.R 如下:

library(shiny)
library(bslib)# Define UI for slider demo app ----
ui <- page_sidebar(# App title ----title = "Blank space txt to csv | v0.0.1",# Sidebar panel for inputs ----sidebar = sidebar(# Input: Select a file ----fileInput("file1","Choose TXT File",multiple = TRUE,accept = c("text/csv","text/comma-separated-values,text/plain","text/blank-separated-values,text/plain",".csv")),tags$hr(),sliderInput("num","show number:",min = 2,max = 1000,value = 10),# Horizontal line ----tags$hr(),# Input: Checkbox if file has header ----checkboxInput("header", "Header", TRUE),# Input: Select separator ----radioButtons("sep","Separator",choices = c(Comma = ",",Semicolon = ";",Blank = " ",Tab = "\t"),selected = " "),# Input: Select quotes ----radioButtons("quote","Quote",choices = c(None = "","Double Quote" = '"',"Single Quote" = "'"),selected = ''),# Horizontal line ----tags$hr(),# Input: Select number of rows to display ----radioButtons("disp","Display",choices = c(Head = "head",All = "all"),selected = "head"),# ButtondownloadButton("downloadData", "Download csv")),# Output: Data file ----tableOutput("contents")
)# Define server logic to read selected file ----
server <- function(input, output) {output$contents <- renderTable({# input$file1 will be NULL initially. After the user selects# and uploads a file, head of that data file by default,# or all rows if selected, will be shown.req(input$file1)df <- read.csv(input$file1$datapath,header = input$header,sep = input$sep,quote = input$quote)if (input$disp == "head") {return(head(df, n=input$num))} else {return(df, n=input$num)}})# Downloadable csv of selected dataset ----output$downloadData <- downloadHandler(filename = function() {req(input$file1)paste(input$file1$datapath, ".csv", sep = "")},content = function(file) {req(input$file1)df <- read.csv(input$file1$datapath,header = input$header,sep = input$sep,quote = input$quote)write.csv(df, file, row.names = FALSE, quote=F)})
}if(0){# show blank separated txt file with headerrunApp("script/app3/")
}# Create Shiny app ----
shinyApp(ui, server)

Ref

  • https://shiny.posit.co/r/getstarted/shiny-basics/lesson1/

End

http://www.fp688.cn/news/164409.html

相关文章:

  • 网站主页设计优点新闻株洲最新
  • php企业网站开发教程企业文化建设方案
  • 网站建设专业客服接听术语百度一下官网入口
  • 公司网站建设gghhhj外链推广
  • 南充住房和城乡建设厅网站百度浏览器广告怎么投放
  • 北京市网站开发广西疫情最新消息
  • 网站开发架构有哪些广告软文范例200字
  • 化妆品网站制作需要网站设计的毕业论文
  • 做养生产品哪个网站好seo推广公司哪家好
  • 建设网站商城需要多少费用吗西安竞价托管
  • 网站建设 引导如何建立网站服务器
  • 武汉开发网站建设广告门
  • 高端的网站设计制作沈阳沈河seo网站排名优化
  • 玩具网站建设服务公司分发平台
  • Dw怎么做网站往里面加标题和字烟台seo快速排名
  • 网站建设所需的基本内容广告宣传费用一般多少
  • 做sgs认证公司网站北京十大最靠谱it培训机构
  • 毕设网站建设今日热点新闻头条排行榜
  • 镇江百度代理seo快速排名软件网址
  • 公司做网站哪里做刷排名seo
  • 如何编辑网页互联网seo是什么
  • 网站开发遵循网推获客平台
  • 简单的购物网站模板优化资讯
  • 66039域名查询网上海seo网站推广
  • 网站 标题 字体培训机构在哪个平台找
  • 销客多官网seo短视频网页入口引流
  • 网站文件解压搜图片百度识图
  • 2024疫情最新数据消息360优化大师官方网站
  • 校园网站建设cfa一级看多久两分钟
  • 泰安选择企业建站公司seo搜索引擎优化培训班