| 所在主题: | |
| 文件名: Q&A.zip | |
| 资料下载链接地址: https://bbs.pinggu.org/a-3017988.html | |
本附件包括:
|
|
| 附件大小: | |
|
如题, 如何才能在shiny main panel上看到我simulated 数据x?
代码如下: ui <- fluidPage( titlePanel("Lesson 1 Introduction to Sample Size Calcuation in Clinical Trials"), sidebarLayout( sidebarPanel( #Select the sample size; selectInput(inputId="size", label="Sample size you choose", choices=seq(1, 30, by=1), selected=5), numericInput("seed","Seed Number to generate Sample is", 12345, min=0, max=20000), numericInput("simn", "Number of Trials", 2, min=1, max=1000) ), mainPanel( h1("Why should we consider Sample Size in Clinical Trials?"), h3("Because insufficient size will make an effective drug fail to show efficacy", style = "font-family: 'times'; font-si16pt"), br(), br(), strong("An example"), br(), em("Suppose a new tech which improves the quality, which is measured by use of the quality in kg, of the product. The previous standard is mean of 3kg, while now the tech patent owner claims to the quality could reach to 5kg and the standard deviation is 3. Therefore, we would like to testify this statement by use of a trial"), br(), code("it could be easily calculate out to reach a 80% power, we need to sample 16, so if we sample 10, 12, 14, let's see what the power is" ), div("This could be shown in the example", style = "color:blue"), br(), p("span does the same thing as div, but it works with", span("groups of words", style = "color:blue"), "that appear inside a paragraph."), #Output the results you want with font of BOLD; strong(textOutput("size")), #output the number of trials; strong(textOutput('n_trial')), #The seed used to generate the data is; strong(textOutput('seed')), #Output the sample simulated data; DT::dataTableOutput("dat") ) ) ) server<-function(input, output){ if(!require(DT)) install.packages("DT") library(DT) output$size <- renderText({ paste("You have selected sample size is", input$size) }) output$n_trial<-renderText({ paste("You have done", input$simn, "trials") }) output$seed<-renderText({ paste("The seed used to generate the data is", is.numeric(input$seed)) }) output$dat<-DT::renderDataTable(DT::datatable({ x<-matrix(0, nrow=input$simn, ncol=input$size) for(i in 1:input$simn){ x[i,]<-rnorm(input$size,0,1) } x })) } shinyApp(ui=ui, server=server) |
|
熟悉论坛请点击新手指南
|
|
| 下载说明 | |
|
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。 2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。 3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。 (如有侵权,欢迎举报) |
|
京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明