[kepler-users] passing a pathname as a Parameter or Constant in RExpression

ben leinfelder leinfelder at nceas.ucsb.edu
Wed Nov 23 12:37:56 PST 2011


Hi Allen,
Unfortunately, the RExpression actor operates pretty independently from the rest of the workflow and its parameters. As you mention, you can feed the DataOutDir value into each RExpression actor (provided the input port name is "DataOutDir") and reference it as you would any other object in R. But it is tedious and clutters the workflow with connections.

Because each RExpression actor executes its script in a completely new R session, you can't just feed in the value to the first RExpression actor and expect it to be around for the next ones in your workflow.
Many Kepler/R users get around this "feature" by explicitly saving their workspace image in one R actor and then explicitly reloading that workplace in the next R actor. This means any objects you had in RExpression1 will be available in RExpression2. That can be a useful approach when dealing with very large data frames and I imagine it'd also be useful for your case. Just be careful not to squash on - or be squashed on - other variables as you move down the line with your RExpression actors. It's kind of a use-at-your-own-risk way of doing R in Kepler.

Make sense?
-ben

On Nov 23, 2011, at 12:23 PM, Hurlbert, Allen Hartley wrote:

> Hello all,
>  
> I'm using Kepler 2.2 on a Windows 7 machine with R 2.14.0.
>  
> Following some of the examples in the UserManual, I've tried creating a Parameter in which I specify a directory to which output should be written.
>  
> E.g.,
>  
> DataOutDir: "//bioark.bio.unc.edu/hurlbertallen/manuscripts/birdmigration/workflow/data"
>  
> I am using RExpression actors to manipulate data and then I try to write that data using something like
>  
> write.csv(output, paste(DataOutDir,"/output.csv",sep=""))
>  
> but Kepler doesn't seem to be treating DataOutDir as an R object which is how I was thinking about it.
>  
> I can see that if I create a Constant with the pathname as a string, and then port this directly into the RExpression actor that it works as expected. The trick is that I have lots of RExpression actors where I'd like to specify this pathname, and would prefer not having to add lots of unnecessary visual clutter to the workflow by adding extra ports and relations just to bring in the pathname everywhere its needed. Is there a simpler way?
>  
> Is my question any different if I'm talking about creating a Parameter that is an integer value (e.g. the year for which data will be subsetted), that I'd like to reference repeatedly in different RExpression actors? I guess I'm thinking of the Lotka-Volterra example where the model parameters are not explicitly linked by relations to the actual expressions. Can I create the equivalent of a Parameter that is universally visible to RExpressions?
>  
> I acknowledge that the phrasing of my question may reflect a complete misunderstanding of how Kepler works, and so I appreciate any and all feedback.
>  
> Thanks,
> Allen
> _______________________________________________
> Kepler-users mailing list
> Kepler-users at kepler-project.org
> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users




More information about the Kepler-users mailing list