From 2f6e5dad6589dabc16e797f7f03fedd30fc58acc Mon Sep 17 00:00:00 2001 From: Eduardo Junior <edujrrib@gmail.com> Date: Sat, 27 Aug 2016 13:03:06 -0300 Subject: [PATCH] =?UTF-8?q?Corrige=20a=20escrita=20de=20vari=C3=A1veis=20e?= =?UTF-8?q?=20fun=C3=A7=C4=A9es=20no=20.GlobalEnv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove o global.R para que os objetos não sejam salvos na sessão do usuário (http://shiny.rstudio.com/articles/scoping.html) --- inst/ShinyApps/labestDataView/global.R | 31 ------------------------- inst/ShinyApps/labestDataView/server.R | 32 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 31 deletions(-) delete mode 100644 inst/ShinyApps/labestDataView/global.R diff --git a/inst/ShinyApps/labestDataView/global.R b/inst/ShinyApps/labestDataView/global.R deleted file mode 100644 index 280e94a8..00000000 --- a/inst/ShinyApps/labestDataView/global.R +++ /dev/null @@ -1,31 +0,0 @@ -##------------------------------------------- -## global.R - -library(xtable) -library(labestData) - -data(keywords, package = "labestData") -keywords$obra <- gsub( - pattern = "^([A-Z]{1}[a-z]*)[A-Z]{1}[a-z]{1}.*$", - replacement = "\\1", - x = keywords$name) - -howmanydigits <- function(x) { - x <- na.omit(x) - if (is.numeric(x) && all(x%%1 == 0)) { - 0 - } else if (is.numeric(x)) { - 1 + floor(log10(1/min(diff(sort(unique(x)))))) - } else { - 0 - } -} - -static_help <- function(pkg, topic, out, - links = tools::findHTMLlinks()) { - pkgRdDB = tools:::fetchRdDB(file.path( - find.package(pkg), 'help', pkg)) - force(links) - tools::Rd2HTML(pkgRdDB[[topic]], out, package = pkg, - Links = links, no_links = is.null(links)) -} diff --git a/inst/ShinyApps/labestDataView/server.R b/inst/ShinyApps/labestDataView/server.R index c98ec179..e91dbf34 100644 --- a/inst/ShinyApps/labestDataView/server.R +++ b/inst/ShinyApps/labestDataView/server.R @@ -1,3 +1,35 @@ +##------------------------------------------- +## Variables and functions + +library(xtable) +library(labestData) + +## data(keywords, package = "labestData") +keywords$obra <- gsub( + pattern = "^([A-Z]{1}[a-z]*)[A-Z]{1}[a-z]{1}.*$", + replacement = "\\1", + x = keywords$name) + +howmanydigits <- function(x) { + x <- na.omit(x) + if (is.numeric(x) && all(x%%1 == 0)) { + 0 + } else if (is.numeric(x)) { + 1 + floor(log10(1/min(diff(sort(unique(x)))))) + } else { + 0 + } +} + +static_help <- function(pkg, topic, out, + links = tools::findHTMLlinks()) { + pkgRdDB = tools:::fetchRdDB(file.path( + find.package(pkg), 'help', pkg)) + force(links) + tools::Rd2HTML(pkgRdDB[[topic]], out, package = pkg, + Links = links, no_links = is.null(links)) +} + ##------------------------------------------- ## server.R -- GitLab