{"id":105978,"date":"2024-09-20T03:27:10","date_gmt":"2024-09-19T19:27:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=105978"},"modified":"2024-09-20T03:27:10","modified_gmt":"2024-09-19T19:27:10","slug":"r-web-write","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/r-web-write.html","title":{"rendered":"\u5982\u4f55\u7528 R \u8bed\u8a00\u7f16\u5199 web \u7a0b\u5e8f"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | Shiny \u662f\u4e00\u4e2a\u6765\u81ea RStudio \u7684\u5de5\u5177\u5305\uff0c\u5b83\u8ba9\u521b\u5efa web \u7a0b\u5e8f\u53d8\u5f97\u66f4\u5bb9\u6613\u3002\u5b83\u80fd\u4ece R \u63a7\u5236\u53f0\u8f7b\u677e\u5b89\u88c5\uff0c\u53ea\u9700\u8981\u4e00\u884c\uff0c\u5c31\u53ef\u4ee5\u52a0\u8f7d\u597d\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u6765\u4f7f\u7528\u3002\u8fd9\u91cc\u6709\u4e00\u4e2a\u5f88\u68d2\u7684\u6559\u7a0b\uff0c\u5b83\u53ef\u4ee5\u5728\u524d\u9762\u8bfe\u7a0b\u57fa\u7840\u4e0a\uff0c\u5e26\u7740\u4f60\u7406\u89e3\u5e94\u7528\u67b6\u8bbe\u7684\u6982\u5ff5\u3002 Shiny \u7684\u6388\u6743\u662f GPLv3\uff0c\u6e90\u4ee3\u7801\u53ef\u4ee5\u5728 GitHub \u4e0a\u83b7\u5f97\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u6211\u7684\u4e00\u4e2a\u4eb2\u5bc6\u670b\u53cb\u6700\u8fd1\u5728\u7528 R \u7f16\u5199\u4e1c\u897f\u3002\u6211\u4e00\u76f4\u90fd\u5bf9\u5b83\u5f88\u611f\u5174\u8da3\uff0c\u4e5f\u4e00\u76f4\u5728\u8bd5\u56fe\u6324\u65f6\u95f4\uff0c\u5b66\u4e60\u66f4\u591a\u5173\u4e8e R \u7684\u77e5\u8bc6\u4ee5\u53ca\u53ef\u7528\u5b83\u505a\u7684\u4e8b\u60c5\u3002\u63a2\u7d22 R \u7684\u8d85\u5f3a\u6570\u5b57\u5904\u7406\u80fd\u529b\u5bf9\u6211\u800c\u8a00\u6709\u4e9b\u56f0\u96be\uff0c\u56e0\u4e3a\u6211\u5e76\u4e0d\u5982\u6211\u670b\u53cb\u90a3\u6837\u6709\u4e00\u4e2a\u6570\u5b66\u5934\u8111\u3002\u6211\u8fdb\u5c55\u6709\u70b9\u6162\uff0c\u4f46\u6211\u4e00\u76f4\u8bd5\u56fe\u5c06\u5b83\u4e0e\u6211\u5728\u5176\u4ed6\u9886\u57df\u7684\u7ecf\u9a8c\u8054\u7cfb\u8d77\u6765\uff0c\u6211\u751a\u81f3\u5f00\u59cb\u8003\u8651\u975e\u5e38\u7b80\u5355\u7684 web \u7a0b\u5e8f\u3002<\/p>\n Shiny \u662f\u4e00\u4e2a\u6765\u81ea RStudio \u7684\u5de5\u5177\u5305\uff0c\u5b83\u8ba9\u521b\u5efa web \u7a0b\u5e8f\u53d8\u5f97\u66f4\u5bb9\u6613\u3002\u5b83\u80fd\u4ece R \u63a7\u5236\u53f0\u8f7b\u677e\u5b89\u88c5\uff0c\u53ea\u9700\u8981\u4e00\u884c\uff0c\u5c31\u53ef\u4ee5\u52a0\u8f7d\u597d\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u6765\u4f7f\u7528\u3002\u8fd9\u91cc\u6709\u4e00\u4e2a\u5f88\u68d2\u7684\u6559\u7a0b\uff0c\u5b83\u53ef\u4ee5\u5728\u524d\u9762\u8bfe\u7a0b\u57fa\u7840\u4e0a\uff0c\u5e26\u7740\u4f60\u7406\u89e3\u5e94\u7528\u67b6\u8bbe\u7684\u6982\u5ff5\u3002 Shiny \u7684\u6388\u6743\u662f GPLv3\uff0c\u6e90\u4ee3\u7801\u53ef\u4ee5\u5728 GitHub \u4e0a\u83b7\u5f97\u3002<\/p>\n \u8fd9\u662f\u4e00\u4e2a\u7528 Shiny \u5199\u7684\u7b80\u5355\u7684\u5c0f web \u7a0b\u5e8f\uff1a<\/p>\n library(shiny)\r\n\r\nserver <- function(input, output, session) {\r\n observe({\r\n myText <- paste(\"Value above is: \", input$textIn)\r\n updateTextInput(session, \"textOut\", value=myText)\r\n })\r\n}\r\n\r\nui <- basicPage(\r\n h3(\"My very own sample application!\"),\r\n textInput(\"textIn\", \"Input goes here, please.\"),\r\n textInput(\"textOut\", \"Results will be printed in this box\")\r\n)\r\n\r\nshinyApp(ui = ui, server = server)\r\n<\/pre>\n |