From 0f48c9b5b7d0c76012a7ee7ca6b186d4cec944d9 Mon Sep 17 00:00:00 2001 From: Dillon Hammill Date: Mon, 10 May 2021 13:16:58 +1000 Subject: [PATCH] DataEditR v0.1.1. --- DESCRIPTION | 4 ++-- NEWS.md | 5 +++++ R/dataInput.R | 8 ++++++-- R/data_edit.R | 10 ++++++++-- README.md | 8 ++++---- docs/404.html | 2 +- docs/CODE_OF_CONDUCT.html | 2 +- docs/articles/DataEditR.html | 2 +- docs/articles/index.html | 2 +- docs/authors.html | 2 +- docs/index.html | 10 +++++----- docs/news/index.html | 13 +++++++++++-- docs/pkgdown.yml | 2 +- docs/reference/dataEdit.html | 2 +- docs/reference/dataFilter.html | 2 +- docs/reference/dataInput.html | 10 ++++++++-- docs/reference/dataOutput.html | 2 +- docs/reference/dataSelect.html | 2 +- docs/reference/data_edit.html | 2 +- docs/reference/index.html | 2 +- man/dataInput.Rd | 6 +++++- 21 files changed, 66 insertions(+), 32 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a76fe29..f645266 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: DataEditR Title: An Interactive Editor for Viewing, Entering, Filtering & Editing Data -Version: 0.1.0 -Date: 2020-12-17 +Version: 0.1.1 +Date: 2021-05-10 Authors@R: person(given = "Dillon", family = "Hammill", diff --git a/NEWS.md b/NEWS.md index 987852f..a79963c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# DataEditR 0.1.1 + +* Ensure `dataInput()` searches for data outside `data_edit()`. +* Prevent loading of highlighted data object in RStudio when data has been supplied to `data_edit()` directly. + # DataEditR 0.1.0 * Make the switch to GitHub Actions for continuous integration. diff --git a/R/dataInput.R b/R/dataInput.R index 122e85a..dc82144 100644 --- a/R/dataInput.R +++ b/R/dataInput.R @@ -16,6 +16,8 @@ #' \code{read_fun} when reading in files. #' @param hide logical indicating whether the data input user interface should #' be hidden from the user, set to FALSE by default. +#' @param envir the environment in which to search for the supplied data, set to +#' the \code{parent.frame()} of \code{dataInput} by default. #' #' @importFrom shiny fluidRow splitLayout textInput fileInput NS moduleServer #' reactive updateTextInput observeEvent eventReactive @@ -89,7 +91,8 @@ dataInputServer <- function(id, data = NULL, read_fun = "read.csv", read_args = NULL, - hide = FALSE) { + hide = FALSE, + envir = parent.frame()) { # SERVER moduleServer(id, function(input, @@ -148,7 +151,8 @@ dataInputServer <- function(id, # DATA INPUT data_input <- eventReactive(input$data, { tryCatch( - eval(parse(text = input$data)), + eval(parse(text = input$data), + envir = envir), error = function(e) { return(NULL) } diff --git a/R/data_edit.R b/R/data_edit.R index 82d09bf..78b2ca1 100644 --- a/R/data_edit.R +++ b/R/data_edit.R @@ -154,11 +154,16 @@ data_edit <- function(x = NULL, code = FALSE, ...) { + # DATA ENVIRONMENT ----------------------------------------------------------- + + # SEARCH DATA OUTSIDE DATA_EDIT + envir <- parent.frame() + # PREPARE DATA --------------------------------------------------------------- # RSTUDIO ADDIN/DATA context <- getActiveDocumentContext() - if(nzchar(context$selection[[1]]$text)) { + if(is.null(x) & nzchar(context$selection[[1]]$text)) { data <- context$selection[[1]]$text } else { if(!is.null(dim(x))) { @@ -280,7 +285,8 @@ data_edit <- function(x = NULL, data = data, read_fun = read_fun, read_args = read_args, - hide = hide) + hide = hide, + envir = envir) # search in parent frame # RESET FILTERS observeEvent(data_input(), { diff --git a/README.md b/README.md index 62e714f..8a544d2 100644 --- a/README.md +++ b/README.md @@ -132,8 +132,8 @@ citation("DataEditR") #> #> To cite package 'DataEditR' in publications use: #> -#> Dillon Hammill (2020). DataEditR: An Interactive Editor for Viewing, -#> Entering, Filtering & Editing Data. R package version 0.1.0. +#> Dillon Hammill (2021). DataEditR: An Interactive Editor for Viewing, +#> Entering, Filtering & Editing Data. R package version 0.1.1. #> https://github.com/DillonHammill/DataEditR #> #> A BibTeX entry for LaTeX users is @@ -141,8 +141,8 @@ citation("DataEditR") #> @Manual{, #> title = {DataEditR: An Interactive Editor for Viewing, Entering, Filtering & Editing Data}, #> author = {Dillon Hammill}, -#> year = {2020}, -#> note = {R package version 0.1.0}, +#> year = {2021}, +#> note = {R package version 0.1.1}, #> url = {https://github.com/DillonHammill/DataEditR}, #> } ``` diff --git a/docs/404.html b/docs/404.html index 14b7676..86fb67a 100644 --- a/docs/404.html +++ b/docs/404.html @@ -79,7 +79,7 @@ DataEditR - 0.1.0 + 0.1.1 diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html index db69864..1da52cc 100644 --- a/docs/CODE_OF_CONDUCT.html +++ b/docs/CODE_OF_CONDUCT.html @@ -79,7 +79,7 @@ DataEditR - 0.1.0 + 0.1.1 diff --git a/docs/articles/DataEditR.html b/docs/articles/DataEditR.html index ce1a726..370ab81 100644 --- a/docs/articles/DataEditR.html +++ b/docs/articles/DataEditR.html @@ -38,7 +38,7 @@ DataEditR - 0.1.0 + 0.1.1 diff --git a/docs/articles/index.html b/docs/articles/index.html index 956787b..6894306 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -79,7 +79,7 @@ DataEditR - 0.1.0 + 0.1.1 diff --git a/docs/authors.html b/docs/authors.html index 230590c..aef44cf 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -79,7 +79,7 @@ DataEditR - 0.1.0 + 0.1.1 diff --git a/docs/index.html b/docs/index.html index 0f49582..68ee859 100644 --- a/docs/index.html +++ b/docs/index.html @@ -40,7 +40,7 @@ DataEditR - 0.1.0 + 0.1.1 @@ -168,8 +168,8 @@

#> #> To cite package 'DataEditR' in publications use: #> -#> Dillon Hammill (2020). DataEditR: An Interactive Editor for Viewing, -#> Entering, Filtering & Editing Data. R package version 0.1.0. +#> Dillon Hammill (2021). DataEditR: An Interactive Editor for Viewing, +#> Entering, Filtering & Editing Data. R package version 0.1.1. #> https://github.com/DillonHammill/DataEditR #> #> A BibTeX entry for LaTeX users is @@ -177,8 +177,8 @@

#> @Manual{, #> title = {DataEditR: An Interactive Editor for Viewing, Entering, Filtering & Editing Data}, #> author = {Dillon Hammill}, -#> year = {2020}, -#> note = {R package version 0.1.0}, +#> year = {2021}, +#> note = {R package version 0.1.1}, #> url = {https://github.com/DillonHammill/DataEditR}, #> } diff --git a/docs/news/index.html b/docs/news/index.html index c0c4550..07d78fd 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -79,7 +79,7 @@ DataEditR - 0.1.0 + 0.1.1 @@ -125,6 +125,15 @@

Changelog

Source: NEWS.md +
+

+DataEditR 0.1.1 Unreleased +

+ +

DataEditR 0.1.0 Unreleased @@ -139,7 +148,7 @@

DataEditR 0.0.9 2020-12-12

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 568e9c2..f3abccd 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -3,5 +3,5 @@ pkgdown: 1.6.1 pkgdown_sha: ~ articles: DataEditR: DataEditR.html -last_built: 2020-12-17T06:38Z +last_built: 2021-05-10T03:12Z diff --git a/docs/reference/dataEdit.html b/docs/reference/dataEdit.html index 38ddd40..0e2ac97 100644 --- a/docs/reference/dataEdit.html +++ b/docs/reference/dataEdit.html @@ -80,7 +80,7 @@ DataEditR - 0.1.0 + 0.1.1
diff --git a/docs/reference/dataFilter.html b/docs/reference/dataFilter.html index 3f5d878..b03b68b 100644 --- a/docs/reference/dataFilter.html +++ b/docs/reference/dataFilter.html @@ -80,7 +80,7 @@ DataEditR - 0.1.0 + 0.1.1 diff --git a/docs/reference/dataInput.html b/docs/reference/dataInput.html index 92a9b4d..df3ba2f 100644 --- a/docs/reference/dataInput.html +++ b/docs/reference/dataInput.html @@ -80,7 +80,7 @@ DataEditR - 0.1.0 + 0.1.1 @@ -138,7 +138,8 @@

Shiny module for data input

data = NULL, read_fun = "read.csv", read_args = NULL, - hide = FALSE + hide = FALSE, + envir = parent.frame() )

Arguments

@@ -175,6 +176,11 @@

Arg hide

logical indicating whether the data input user interface should be hidden from the user, set to FALSE by default.

+ + + envir +

the environment in which to search for the supplied data, set to +the parent.frame() of dataInput by default.

diff --git a/docs/reference/dataOutput.html b/docs/reference/dataOutput.html index 8978e89..7acc0d0 100644 --- a/docs/reference/dataOutput.html +++ b/docs/reference/dataOutput.html @@ -80,7 +80,7 @@ DataEditR - 0.1.0 + 0.1.1 diff --git a/docs/reference/dataSelect.html b/docs/reference/dataSelect.html index e4224c4..9f64895 100644 --- a/docs/reference/dataSelect.html +++ b/docs/reference/dataSelect.html @@ -80,7 +80,7 @@ DataEditR - 0.1.0 + 0.1.1 diff --git a/docs/reference/data_edit.html b/docs/reference/data_edit.html index cf42906..0d6ce62 100644 --- a/docs/reference/data_edit.html +++ b/docs/reference/data_edit.html @@ -83,7 +83,7 @@ DataEditR - 0.1.0 + 0.1.1 diff --git a/docs/reference/index.html b/docs/reference/index.html index 8c6fd95..35dfd5e 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -79,7 +79,7 @@ DataEditR - 0.1.0 + 0.1.1 diff --git a/man/dataInput.Rd b/man/dataInput.Rd index 3f7cbf2..e95d093 100644 --- a/man/dataInput.Rd +++ b/man/dataInput.Rd @@ -13,7 +13,8 @@ dataInputServer( data = NULL, read_fun = "read.csv", read_args = NULL, - hide = FALSE + hide = FALSE, + envir = parent.frame() ) } \arguments{ @@ -36,6 +37,9 @@ is selected, set to \code{read.csv} by default.} \item{hide}{logical indicating whether the data input user interface should be hidden from the user, set to FALSE by default.} + +\item{envir}{the environment in which to search for the supplied data, set to +the \code{parent.frame()} of \code{dataInput} by default.} } \description{ Shiny module for data input