3

我还没有安装闪亮的服务器,我宁愿没有。当我从 RStudio 运行 runApp 时,我在地址 localhost:port 处打开了一个浏览器窗口。我希望这个应用程序从磁盘读取数据。为了让客户端(index.html)能够执行此操作,我需要将这些数据放在哪个路径上,window.open(path/data)并且会打开一个显示原始数据的新窗口?

我在index.html

Shiny.addCustomMessageHandler ("callbackHandler",
    function (value)
    {
        window.open(value.file);
    });

server.R中

session$sendCustomMessage (type = "callbackHandler", message = list (file = trackfile, ...));
4

1 回答 1

2

runApp不提供文件。它侦听给定端口并在该端口上为一个应用程序提供服务。文件可以从服务器端的 www 访问,并且可以访问 ui 等。

如果你想提供文件,你需要有一个单独的 http 服务器运行,比如 python simplehttpserver 或 servr github.com/yihui/servr 或R rook包。

于 2014-07-10T16:41:44.920 回答