Code Behind Rstudio Server Export Function

Is there an R command to trigger the download of a file from Rstudio Server?

Does browseURL do it for you:

browseURL                package:utils                 R Documentation

Load URL into a WWW Browser

Description:

Load a given URL into a WWW browser.

Usage:

browseURL(url, browser = getOption("browser"), encodeIfNeeded = FALSE)

That should fire it up in a browser. To download directly in R, download.file is what you want, but that hangs the command line until complete.

Can the export files option be limited in Rstudio client (open source edition)

Finally, and after asking for help to the people at Rstudio, I get the answer to this and is that the export option could not be limited in the open source edition of Rstudio server. This option works only with the pro version.
You can check this in https://support.rstudio.com/hc/en-us/community/posts/222515687-Limit-files-export-in-Rstudio-server-open-source-edition

I will try to limit at the S.O. level. I will post any workaround if I succeed.

How to define a function so that the R studio can predict its variable?

Assuming you have a function foo:

foo <- function(x, y){
x + y
}

In RStudio, go to Tools > Global Options > Code > Edit Snippets and add the following one:

snippet foo
foo(x = ${1:x}, y = ${2:y})

Then if you type foo and hit tab you should have your snippet available.

Sample Image

How to use R Studio View() function programatically / in a package

RStudio replaces the utils::View function with their own function when it starts up. Their source is

function (...) 
.rs.callAs(name, hook, original, ...)
<environment: 0x1036a6dc0>

You can't just copy this into your package, because it depends on things in that environment, and there's no way for your package to get it.

However, you can do this:

myView <- function(x, title)
get("View", envir = as.environment("package:utils"))(x, title)

and export myView from your package. If you run this in RStudio, you'll get their function, if you run it anywhere else, you'll get the regular one.

R: export code with formatting and line numbers to Microsoft Word

Word has line numbering facilities. You can do by section, page, or document:

file:///Applications/Microsoft%20Office%202011/Microsoft%20Word.app/Contents/Resources/en.lproj/Help/art/Pod_WD_Layout_TextLayout.gif

Sample Image



Related Topics



Leave a reply



Submit