[R] Opencpu and caching
jdnewmil at dcn.davis.ca.us
Sat Apr 29 02:23:19 CEST 2017
You have already been told this is the wrong list for these questions. Go ask in the OpenCPU support areas.
My very limited understanding of OpenCPU is that what you are asking for is specifically not supported. You need to setup your own function that does everything before it returns.
Sent from my phone. Please excuse my brevity.
On April 28, 2017 4:42:15 PM PDT, Jake Stone <jake at jakestone.net> wrote:
>I am new to opencpu. My specialty is java. I use R for very specific
>My understanding is that each API call to opencpu opens a new R
>My function will classify the data input using the predict method of a
>linear discriminant analysis (lda from MASS package).
>The initial linear discriminant analysis on 100000+ cases and 150+
>levels takes time (over 30 seconds). This function returns a list.
>The subsequent prediction function is quick and returns a simple
>I run one opencpu function to run the initial lda. This only needs to
>I want my second function to ONLY run the predict function. This is
>possible if the lda is held as a global variable.
>My understanding is that global variables are not possible in opencpu.
>will have to cache the lda on the file system.
>In sum, I need to run the lda just once and hold the analysis (a list)
>either in memory or on the file system. I then retrieve the lda
>when predict is called.
>Which approach is best, and how to implement?
>1. I could use an opencpu function that creates and returns the lda.
>when I call a prediction, I could retrieve the lda object (a list) from
>file system. But how do I retrieve the list from the file system. How
>does opencpu even know where it is?
>2. I could use r.cache package. I haven't used this package before but
>docs suggest it is a solution. Will this work?
>Any advice would be deeply appreciated.
> [[alternative HTML version deleted]]
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
More information about the R-help