deployrExternal() Nightmare

[This article was first published on Dan Thompson, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

As part of Microsoft’s acquisition of Revolution Analytics, Microsoft have turbo-boosted their newly acquired package DeployR. DeployR is a cool way for data scientists to throw their scripts into a repository, which after validation, are exposed via the DeployR API to an application developer to consume. Further information about DeployR is for another day. This post is about my futile attempts to access data in the base repository. The deployrExternal() Function DeployR has a function called deployrExternal() which allows the scripts to access a central repository. Scripts or data can be stored in the “public” folder of the repository, which can then be accessed via any other script using the deployrExternal() function. The Problem You’ve set up your VM, you’ve installed DeployR, and you’ve done a quick test script to check all the relevant functions work. Boring stuff done – you can now do your cool R stuff, right? Unfortunately, on executing your deployrExternal() line, you may get this error message: I spent quite a while uninstalling and reinstalling DeployR, and messing around with the root folders in the Program Files\\..\deployr repository. Eventually, I purchased a Microsoft Support subscription and got in touch with them. They continually sent me links to different versions of documentation on their website, asking if I had read it, followed by substantial radio silence. Then … I got a helpful reply! It turns out that the deployrExternal() function does not have access to the base DeployR directory (as at version 8.0.5). The problem has now been registered as a bug, and they said they will be fixing it in the next release. Workaround One workaround is to hard-code the full file path with the name of the file you’re referencing. It could look something like this: “C:\\Program Files\Microsoft\DeployR-{version number}\deployr\external\repository\public\…” It’s not great, but the base folder should be static after installation, so is low risk. Alternatively, Microsoft suggested to use a custom function to replicate deployrExternal(): deployrExternalTemp<-function(filename, isPublic=TRUE) { require(deployrUtils) require(stringr) is.deplyr <- !is.na(str_extract(Sys.getenv("HOME"),"RServe8")) if ( is.deplyr == TRUE ) { dplyrhome<-paste(Sys.getenv("REVODEPLOYR8_1_HOME"),"..",sep="/") extfile<-file.path(dplyrhome,deployrExternal(filename,isPublic)) } else { extfile<-file.path(getwd(),filename) return(extfile) } } I hope this helps someone. I’ll update the post if I get a response about a patch or update.

To leave a comment for the author, please follow the link and comment on their blog: Dan Thompson.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)