简体   繁体   English

在部署到 Shinyapps.io 的 Shiny 应用程序中使用 readClipboard() 的问题

[英]Problem using readClipboard() in Shiny app deployed to shinyapps.io

I have created a Shiny App that relies on reading data directly from the user's clipboard.我创建了一个 Shiny App,它依赖于直接从用户的剪贴板读取数据。 This Shiny app works perfectly when running on my local machine;这个 Shiny 应用程序在我的本地机器上运行时运行良好; however when I deploy the app to shinyapps.io I get the following error:但是,当我将应用程序部署到 Shinyapps.io 时,出现以下错误:

Warning: Error in readClipboard: could not find function "readClipboard"

This question was raised before but didn't receive an answer: Paste from client's clipboard on Shiny Server之前提出过这个问题,但没有得到答案: 从客户端剪贴板粘贴到 Shiny 服务器上

My hunch is that I'll probably need to incorporate some javascript function which allows the web browser to read the user's clipboard...but I have zero idea where to start on that :-(我的直觉是,我可能会需要纳入一些JavaScript功能,它允许Web浏览器来读取用户的剪贴板...但我有零知道从哪里开始对:-(

Has anyone achieved this functionality before in a Shiny App deployed to shinyapps.io?有没有人在部署到 Shinyapps.io 的 Shiny App 中实现过这个功能?

This is likely because shinyapps.io runs in a Linux server, and readClipboard() only works on Windows OS.这可能是因为 Shinyapps.io 在 Linux 服务器中运行,而readClipboard()仅适用于 Windows 操作系统。 So I am assuming that you are running locally on a Windows machine.所以我假设您在 Windows 机器上本地运行。

You could try the package clipr .你可以试试包clipr

I never tried myself, but I read that it works on Linux.我自己从未尝试过,但我读到它可以在 Linux 上运行。 From the site where I read about the package 从我阅读有关包裹的网站

Note that on Linux, you will need to install the system requirement, either xclip or xsel.请注意,在 Linux 上,您需要安装系统要求,xclip 或 xsel。 This can be done using for example apt-get install xclip.这可以使用例如 apt-get install xclip 来完成。

I have an app running on a Linux server, and I use the following statement to be able to test it in Windows (in my case is access to a database that is different between systems)我有一个在 Linux 服务器上运行的应用程序,我使用以下语句能够在 Windows 中对其进行测试(在我的情况下是访问不同系统之间的数据库)

if (tolower(Sys.info()['sysname']) == "linux") {

# Linux code here

} else {

# Windows code here

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 2018 年在 Shinyapps.io 上部署的闪亮应用程序在 2019 年无法在本地运行 - shiny app deployed in 2018 on shinyapps.io not working locally in 2019 R - shiny 应用程序中的仪表板日期部署在 shinyapps.io - R - Dashboard date in a shiny app deployed in shinyapps.io 无法在Shinyapps.io中部署闪亮的应用程序 - unable to deploy shiny app in shinyapps.io 闪亮的应用程序可在本地运行,但不适用于Shinyapps.io - shiny app works locally, but not on shinyapps.io 将闪亮的应用程序部署到Shinyapps.io时出错 - An error in deploying shiny app to Shinyapps.io 由于无法定位数据帧,本地工作的 Shiny 应用程序无法部署在 Shinyapps.io 中 - Shiny app that works locally cannot be deployed in shinyapps.io because of not being able to locate the dataframe .html plotGoogleMap部署在Shinyapps.io上时不会加载到Shiny App中 - .html plotGoogleMap does not load in shiny App when deployed on shinyapps.io 部署到 shinyapps.io 的应用程序上的 googlesheets 的多用户身份验证 - Multi-user authentication for googlesheets on an app deployed to shinyapps.io Shinyapps.io 上的闪亮应用程序失败,未找到数据 - shiny app fails on shinyapps.io, data not found Shinyapps.io 中的 Shiny 应用程序未运行(错误:未找到对象 UI) - Shiny App Not Running in Shinyapps.io (Error: Object UI Not Found)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM