简体   繁体   中英

Load .Rda file / Twitter Authentication in OpenCPU with R

I created a package which gets Twitter data with the twitteR package. But to do so it needs the authentication. By now I created a .Rda file on my local system containing the Twitter handshake and placed the file in my package. But when I want to execute the function on OpenCPU it tells me:

Error: cannot open the connection

In call:
readChar(con, 5L, useBytes = TRUE)

So it seems that it can´t find the file.

  • How can I load the .Rda file in OpenCPU?
  • Can I add it to my package so that it is loaded when the package is loaded?
  • Is there a better/easier way for the authentication process?

Thanks for your help

The easiest way to include objects in an R package is by placing them in the data folder of your source package. See writing R extensions 1.1.6 . The appdemo package also has some examples. If you want to automatically load the data when the package is loaded you need to set LazyData: true in your package DESCRIPTION .

The best way to design authentication depends on the design of your system. In public applications it makes sense that the client supplies the authentication credentials as a function argument. If you want your server to read credentials from disk somewhere, make sure you allow this file in the security policies, see section 3.5 of the server manual .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM