Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

"Pbm with retrieving an R function from repository"

flefle Member Posts: 4 Contributor I
edited May 2019 in Help
Hi,
thank you for the development of R Extension, it looks very cool.

I have done the installation without problem (on XP) and can run the R demos Generate Vector and Append Vectors.
The R console also seems to work fine.

However, using the R console, I  tried to write a simple function defined like this
x<-function(){
return(rnorm(1000,100,16))
}


and store x in the repository, like in the demo video.

Using the R console, it works fine, I can retrieve the file where x has been stored, and execute the function.

But I have problem using the Retrieve operator :
first, when I drag the object from repository to the Main Process window, I don't get the R script in a result window
then I add a Execute Script operator,, connect it to the Retrieve operator, and get the following error "The given object null cannot be translated to R"
finally I cannot add an input name in the Execute operator (it does not save anything).

I have tried putting the code of the R function directly in the Execute operator, and it worked.

Do you have any idea regarding what could be wrong with the Retrive operator ?
thank you for your help.
Tagged:

Answers

  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    ok, I will try to summarize how this is supposed to work:

    You can save arbitrary functions or data, whatever fits into a variable in R into a RapidMiner Object. This object then encapsulates the specific variable. You can do this either in the console or by defining a result inside a R Script Operator. In the console you can do this in the variable view. A speciality there is, that you can save more than one variable at once. This is done by grouping the variable in a RapidMiner Object Collection. This collection can be loaded again in the console, but cannot (!) be forwarded to the script operator! In the script operator you need to assign each object that is forwarded a single name with that it is accessible in the R Script. Since the collection would contain multiple variables, this way isn't possible, because we can't store them all under the same name!
    In a process you can define Results in the script operator. These will be delivered as the type you specified. If you choose "Generic R Result" this can be any variable. Then you will have this RapidMiner Object again, containing the variable. You can save it by using the "Store" operator.

    The content of the variables containing functions, data or results, saved in the console or via the "Store" operator, can be loaded again to a process using a "Retrieve" operator. Then they can be forwarded to any script operator and made available under any variable name you want. Then they are accessible inside this script with the name you chose.

    If you stored a variable in such an RapidMiner object they become immutable. You cannot apply any changes on it. This on the one hand ensures that your results are save (unless you overwrite them) and give you a possibility to build up a system of functions that combine to some sort of API and can be shared with others by accessing the same repository. On the other hand this makes it difficult to manage your code base, because you have to store it separately somewhere else. We will address this issue with one of the next releases of the R Extension, so that we can provide a more integrated Development Environment.

    Greetings,
      Sebastian
  • flefle Member Posts: 4 Contributor I
    Thank you for your detailed answer.

    In the console (variable view), when I load back my function, and type its name ('x' in my example) , I get the function's script. If I type x(), it is executed fine. So far so good, it seems my script is stored, as I want.

    However, I noticed a problem : when I try to load the object from the repository, I open the Repository Browser,and hover my cursor on the filename, a popup opens and I can click on the "Click to load" link, to load the metadata.  And this fails ! "Error retrieving metadata for ..."
    The java error is class not found com.rapidminier.operator.r.RResult

    So I suspect that my installation is not so correct, and I might miss some path / environement variable ?

    Regarding the modification of the R script, I noticed this already, and the need to maintain the script outside of RapidMiner.

    Regards

    EDIT
    I'm editing this post, because I made some progress.
    By following this post http://rapid-i.com/rapidforum/index.php?topic=2612.0, I checked my directories, modified a bit the variables (like adding /bin, and JAVA_HOME pointing to both jdk and jre). Now I'm able to store my R script in a repository object and read its meta data.

    But still, when I load it using the Retrieve operator + connect it to the Execute R script operator,  I have the problem that I cannot set a variable name in the Input field of the Execute Script operator.
    I checked the output field of the Retrieve operator, it says its a Generic R Result, which seems ok to me.

    Any idea where to look for an error ?

    Regards

    EDIT
    ok, watching the video, I understand now how one can see the out put of the Retrieve operator in the Result window : one should double click.
    If a vector was saved, the data is displayed, if its a fonction, its script is shown.

    EDIT2
    Contrary to what was said, I still have the meta data problem. Probably I'm dong something wrong when saving the function ?
    On top of the meta data error, I noticed another message when I connect my Retrieve operator to the Execute operator : "The given object nullcannot be translated to R"
  • landland RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 2,531 Unicorn
    Hi,
    it seems to me, that there's already a problem with the object you have stored. Could you send the repository directory to me by mail? I would then be able to verify this?

    Greetings,
      Sebastian
  • flefle Member Posts: 4 Contributor I
    Hi,
    thank you for looking at my problem.

    I have prepared the repository and some screenshots, but how do I attach it to a post / PM ?

    (I have been able to bypass the problem, by puting the script directly in a "Execute script" operator, however this way I can't reuse the function.)

    Regards
Sign In or Register to comment.