[R] Opencpu and caching

Jake Stone jake at jakestone.net
Sat Apr 29 04:07:34 CEST 2017


OK, thanks for the info
 I apologize. I must have misread or misremembered.

I have found the answer btw. R
Cache serves the said purpose perfectly.




On Apr 28, 2017 6:58 PM, "Jeff Newmiller" <jdnewmil at dcn.davis.ca.us> wrote:

A) The https://www.opencpu.org/help.html page recommends a Google Group and
Stack Overflow. If you were "told" otherwise, it was probably because they
thought you needed to learn R, which would be off topic for their support
areas.

B) The R mailing lists Posting Guide says that questions about contributed
packages such as opencpu belong on their respective support areas. I can't
even find any other mentions of opencpu in the archives other than "check
it out".

C) If your question is purely about R, go ahead and ask on the appropriate
R mailing list (quite possibly this one), but phrase it in terms of R and
don't drag in Java or some server architecture that is off topic. To
emphasize this we strongly recommend creating a minimal reproducible
example ("reprex"). There are websites that describe what this means[1][2],
and an R package (called reprex) to help you verify that other people will
in fact be able to run your example at least to the point where it
generates the error you are dealing with.

So, if you need to learn enough R in order to ask your question coherently
in the OpenCPU support areas, maybe you should start with some R
documentation and learn the language?

[1] http://stackoverflow.com/questions/5963269/how-to-make-
a-great-r-reproducible-example

[2] http://adv-r.had.co.nz/Reproducibility.html
--
Sent from my phone. Please excuse my brevity.

On April 28, 2017 5:34:37 PM PDT, Jake Stone <jake at jakestone.net> wrote:
>Opencpu website recommends this site.
>You might want to clarify with them.
>
>
>
>On Apr 28, 2017 5:23 PM, "Jeff Newmiller" <jdnewmil at dcn.davis.ca.us>
>wrote:
>
>> 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
>> >analyses.
>> >
>> >*PROBLEM*
>> >My understanding is that each API call to opencpu opens a new R
>> >session.
>> >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+
>> >factor
>> >levels takes time (over 30 seconds). This function returns a list.
>> >The subsequent prediction function is quick and returns a simple
>> >vector.
>> >
>> >
>> >*APPROACH*
>> >I run one opencpu function to run the initial lda. This only needs
>to
>> >run
>> >once.
>> >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.
>> >So I
>> >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
>> >analysis
>> >when predict is called.
>> >
>> >*QUESTION*
>> >Which approach is best, and how to implement?
>> >1. I could use an opencpu function that creates and returns the lda.
>> >Then
>> >when I call a prediction, I could retrieve the lda object (a list)
>from
>> >the
>> >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
>> >the
>> >docs suggest it is a solution. Will this work?
>> >
>> >Any advice would be deeply appreciated.
>> >
>> >best
>> >jake
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> >______________________________________________
>> >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> >https://stat.ethz.ch/mailman/listinfo/r-help
>> >PLEASE do read the posting guide
>> >http://www.R-project.org/posting-guide.html
>> >and provide commented, minimal, self-contained, reproducible code.
>>

	[[alternative HTML version deleted]]



More information about the R-help mailing list