{"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":"\n\n\n
\u5bfc\u8bfb<\/td>\nShiny \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

\u5f53\u4f60\u5728\u8f93\u5165\u6846\u4e2d\u8f93\u5165\u6587\u5b57\u65f6\uff0c\u5b83\u4f1a\u88ab\u590d\u5236\u5230\u8f93\u51fa\u6846\u4e2d\u63d0\u793a\u8bed\u540e\u3002\u8fd9\u5e76\u6ca1\u6709\u4ec0\u4e48\u5947\u7279\u7684\uff0c\u4f46\u5b83\u5411\u4f60\u5c55\u793a\u4e86\u4e00\u4e2a Shiny \u7a0b\u5e8f\u7684\u57fa\u672c\u7ed3\u6784\u3002\u201cserver\u201d\u90e8\u5206\u5141\u8bb8\u4f60\u5904\u7406\u6240\u6709\u540e\u7aef\u5de5\u4f5c\uff0c\u5982\u8ba1\u7b97\u3001\u6570\u636e\u5e93\u68c0\u7d22\u6216\u7a0b\u5e8f\u9700\u8981\u53d1\u751f\u7684\u4efb\u4f55\u5176\u4ed6\u64cd\u4f5c\u3002\u201cui\u201d\u90e8\u5206\u5b9a\u4e49\u4e86\u63a5\u53e3\uff0c\u5b83\u53ef\u4ee5\u6839\u636e\u9700\u8981\u53d8\u5f97\u7b80\u5355\u6216\u590d\u6742\u3002<\/p>\n

\"\u5982\u4f55\u7528<\/p>\n

\u5305\u62ec\u5728 Shiny \u4e2d\u7684 Bootstrap \u6709\u4e86\u5927\u91cf\u6837\u5f0f\u548c\u4e3b\u9898\uff0c\u6240\u4ee5\u5728\u5b66\u4e60\u4e86\u4e00\u70b9\u540e\uff0c\u5c31\u80fd\u7528 R \u521b\u5efa\u5927\u91cf\u529f\u80fd\u4e30\u5bcc\u7684 web \u7a0b\u5e8f\u3002\u4f7f\u7528\u9644\u52a0\u5305\u53ef\u4ee5\u5c06\u529f\u80fd\u6269\u5c55\u5230\u66f4\u9ad8\u7ea7\u7684 JavaScript \u7a0b\u5e8f\u3001\u6a21\u677f\u7b49\u3002<\/p>\n

\u6709\u51e0\u79cd\u65b9\u5f0f\u5904\u7406 Shiny \u7684\u540e\u7aef\u5de5\u4f5c\u3002\u5982\u679c\u4f60\u53ea\u662f\u5728\u672c\u5730\u8fd0\u884c\u4f60\u7684\u7a0b\u5e8f\uff0c\u52a0\u8f7d\u5e93\u5c31\u80fd\u505a\u5230\u3002\u5bf9\u4e8e\u60f3\u8981\u53d1\u5e03\u5230\u7f51\u7edc\u4e0a\u7684\u7a0b\u5e8f\uff0c\u4f60\u53ef\u4ee5\u5728 RStudio \u7684 Shiny \u7f51\u7ad9\u4e0a\u5171\u4eab\u5b83\u4eec\uff0c\u8fd0\u884c\u5f00\u6e90\u7248\u672c\u7684 Shiny \u670d\u52a1\u5668\uff0c\u6216\u901a\u8fc7\u6309\u5e74\u8ba2\u9605\u670d\u52a1\u4ece RStudio \u5904\u8d2d\u4e70 Shiny Server Pro\u3002<\/p>\n

\u7ecf\u9a8c\u4e30\u5bcc\u7684 R \u5927\u725b\u53ef\u80fd\u5df2\u7ecf\u77e5\u9053 Shiny \u4e86\uff1b\u5b83\u5df2\u7ecf\u5b58\u5728\u5927\u7ea6\u51e0\u5e74\u4e86\u3002\u5bf9\u4e8e\u50cf\u6211\u8fd9\u6837\u6765\u81ea\u4e00\u4e2a\u5b8c\u5168\u4e0d\u540c\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u5e76\u4e14\u5e0c\u671b\u5b66\u4e60\u4e00\u70b9 R \u7684\u4eba\u6765\u8bf4\uff0c\u5b83\u662f\u76f8\u5f53\u6709\u5e2e\u52a9\u7684\u3002<\/p>\n

via: https:\/\/opensource.com\/article\/17\/1\/writing-new-web-apps-shiny<\/a><\/p>\n

\u4f5c\u8005\uff1aD Ruth Bavousett<\/a> \u8bd1\u8005\uff1ageekpi<\/a> \u6821\u5bf9\uff1ajasminepeng<\/a><\/p>\n

\u672c\u6587\u7531 LCTT<\/a> \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a> \u8363\u8a89\u63a8\u51fa<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-8264-1.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/r-web-write.html<\/a>\u7f16\u8f91\u5458\uff1a\u9648\u864e\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb 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 […]<\/p>\n","protected":false},"author":63,"featured_media":77290,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[21],"tags":[],"class_list":["post-105978","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/105978","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=105978"}],"version-history":[{"count":7,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/105978\/revisions"}],"predecessor-version":[{"id":106226,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/105978\/revisions\/106226"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/77290"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=105978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=105978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=105978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}