calculate <- function() paste('time in the Rcube command center is', Sys.time())
is_user_lib <- function(path) {
found <- gsub(rcloud.home('library.*', user='([^/]*)'), '\\1', path)
if(found == path) NULL else found
}
window.shown <- FALSE;
show.window <- function() {
# detect whether cube is installed in user's private repo
pkgpath <- getNamespaceInfo('rcloud.cube', 'path')
user <- is_user_lib(pkgpath)
url = paste0('/shared.R',
if(is.null(user)) NULL else paste0('/',user),
'/rcloud.cube/index.html')
window.name = 'cube'
if(!caps$spawn(url, window.name))
rcloud.html.out(paste0('<a href="', url, '" target="', window.name, '">Open window</a>'))
}
#secret.data.stuff <- NULL
categorical <- function(col) {
if(!window.shown)
show.window()
#secret.data.stuff <<- col
caps$add_dimension(list(
name = 'x',
type = 'categorical'
))
}
execute_query <- function(q) list(x = c('A','B','C'), c(3,2,1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.