diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..49a3e67 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,103 @@ + + +
+ + + + +Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
-This Code of Conduct is adapted from the Contributor Covenant (http:contributor-covenant.org), version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/
+This Code of Conduct is adapted from the Contributor Covenant (http:contributor-covenant.org), version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/
Jos de Jong. Author, copyright holder.
+
jsoneditor.js library in htmlwidgets/jsoneditor, http://github.com/josdejong/jsoneditor/
Mac Gainer. Author, copyright holder.
+
react-json-view library in htmlwidgets/react-json, https://github.com/mac-s-g/react-json-view
Kent Russell. Author, maintainer.
+
R interface
DESCRIPTION
+ Jos de Jong. Author, copyright holder.
-
jsoneditor.js library in htmlwidgets/jsoneditor, http://github.com/josdejong/jsoneditor/
Mac Gainer. Author, copyright holder.
-
react-json-view library in htmlwidgets/react-json, https://github.com/mac-s-g/react-json-view
Kent Russell. Author, maintainer.
-
R interface
de Jong J, Gainer M, Russell K (2023). +listviewer: 'htmlwidget' for Interactive Views of R Lists. +R package version 4.0.0, https://github.com/timelyportfolio/listviewer. +
+@Manual{, + title = {listviewer: 'htmlwidget' for Interactive Views of R Lists}, + author = {Jos {de Jong} and Mac { Gainer} and Kent Russell}, + year = {2023}, + note = {R package version 4.0.0}, + url = {https://github.com/timelyportfolio/listviewer}, +}
A package of R htmlwidgets to interactively view and maybe modify lists
. As of now, listviewer
provides an interface to jsoneditor
and react-json-view
. listviewer
is designed to support multiple interfaces.
A package of R htmlwidgets to interactively view and maybe modify lists
. As of now, listviewer
provides an interface to jsoneditor
and react-json-view
. listviewer
is designed to support multiple interfaces.
CRAN
- +
+install.packages("listviewer")
Development Version
- +
+devtools::install_github("timelyportfolio/listviewer")
jsoneditor
is a really well designed JSON
interactive editor by Jos de Jong. Since most R
data can be represented in JSON
, we can use this great JavaScript
library in R
.
# using the data from the jsoneditor simple example
-# in R list form
-
-library(listviewer)
-
-jsonedit(
- list(
- array = c(1,2,3)
- ,boolean = TRUE
- ,null = NULL
- ,number = 123
- ,object = list( a="b", c="d" )
- ,string = "Hello World"
- )
-)
See the above interactive view of par for yourself.
+jsoneditor
is a really well designed JSON
interactive editor by Jos de Jong. Since most R
data can be represented in JSON
, we can use this great JavaScript
library in R
.
+# using the data from the jsoneditor simple example
+# in R list form
+
+library(listviewer)
+
+jsonedit(
+ list(
+ array = c(1,2,3)
+ ,boolean = TRUE
+ ,null = NULL
+ ,number = 123
+ ,object = list( a="b", c="d" )
+ ,string = "Hello World"
+ )
+)
+# also works with data.frames
+jsonedit( mtcars )
See the above interactive view of par for yourself.
I got this idea courtesy of @jasonpbecker on Twitter. htmlwidgets
dependencies are defined by YAML
. Let’s see the dependencies for jsonedit
.
+jsonedit(
+ yaml.load_file(system.file("htmlwidgets/jsonedit.yaml",package="listviewer"))
+)
How about topojson
?
### experiment with topojson
-library(httr)
-library(pipeR)
-library(listviewer)
-
-# topojson for Afghanistan
-url_path = "https://gist.githubusercontent.com/markmarkoh/8856417/raw/6178d18115d9f273656d294a867c3f83b739a951/customAfghanMap.topo.json"
-
-url_path %>>%
- GET %>>%
- content( as = "text") %>>%
- jsonedit
+### experiment with topojson
+library(httr)
+library(pipeR)
+library(listviewer)
+
+# topojson for Afghanistan
+url_path = "https://gist.githubusercontent.com/markmarkoh/8856417/raw/6178d18115d9f273656d294a867c3f83b739a951/customAfghanMap.topo.json"
+
+url_path %>>%
+ GET %>>%
+ content( as = "text") %>>%
+ jsonedit
react-json-view
is another very nice JSON
interactive editor. We even get copy/paste! All of the above examples should also work with reactjson
.
# using the data from the jsoneditor simple example
-# in R list form
-
-library(listviewer)
-
-reactjson(
- list(
- array = c(1,2,3)
- ,boolean = TRUE
- ,null = NULL
- ,number = 123
- ,object = list( a="b", c="d" )
- ,string = "Hello World"
- )
-)
react-json-view
is another very nice JSON
interactive editor. We even get copy/paste! All of the above examples should also work with reactjson
.
listviewer
works with Shiny
but the implementation is crude and likely to change for jsonedit
while reactjson
integration is much better. If you really want to use jsonedit
with Shiny
, I would recommend debouncing
the change
callback. Here are examples with each.
library(shiny)
-library(listviewer)
-
-# put some data in environment so it will show up
-data(mtcars)
-
-ui <- shinyUI(
- fluidPage(
- jsoneditOutput( "jsed" )
- )
-)
-
-server <- function(input,output){
- output$jsed <- renderJsonedit({
- jsonedit(
- as.list( .GlobalEnv )
- ,"change" = htmlwidgets::JS('function(){
- console.log( event.currentTarget.parentNode.editor.get() )
- }')
- )
-
- })
-}
-
-runApp( list( ui = ui, server = server ) )
library(shiny)
-library(listviewer)
-
-# put some data in environment so it will show up
-data(mtcars)
-
-ui <- shinyUI(
- fluidPage(
- reactjsonOutput( "rjed" )
- )
-)
-
-server <- function(input,output){
- output$rjed <- renderReactjson({
- reactjson( as.list( .GlobalEnv ) )
- })
-
- observeEvent(input$rjed_edit, {
- str(input$rjed_edit, max.level=2)
- })
-}
-
-runApp( list( ui = ui, server = server ) )
+library(shiny)
+library(listviewer)
+
+# put some data in environment so it will show up
+data(mtcars)
+
+ui <- shinyUI(
+ fluidPage(
+ jsoneditOutput( "jsed" )
+ )
+)
+
+server <- function(input,output){
+ output$jsed <- renderJsonedit({
+ jsonedit(
+ jsonlite::toJSON(mtcars, auto_unbox = TRUE, data.frame = "rows")
+ ,"onChange" = htmlwidgets::JS('function(after, before, patch){
+ console.log( after.json )
+ }')
+ )
+
+ })
+}
+
+runApp( list( ui = ui, server = server ) )
+library(shiny)
+library(listviewer)
+
+# put some data in environment so it will show up
+data(mtcars)
+
+ui <- shinyUI(
+ fluidPage(
+ reactjsonOutput( "rjed" )
+ )
+)
+
+server <- function(input,output){
+ output$rjed <- renderReactjson({
+ reactjson( jsonlite::toJSON(mtcars, auto_unbox = TRUE, data.frame = "rows") )
+ })
+
+ observeEvent(input$rjed_edit, {
+ str(input$rjed_edit, max.level=2)
+ })
+}
+
+runApp( list( ui = ui, server = server ) )
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
+Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Developed by Jos de Jong, Mac Gainer, Kent Russell.
+ +Developed by Jos de Jong, Mac Gainer, Kent Russell.
API Changes
-onEdit
, onAdd
, onDelete
, and onSelect
changed to allow disable. See pull 32. The default TRUE
now will pass the event to Shiny if in Shiny context.jsoneditor
to completely rebuilt 0.18.7
+API Changes - onEdit
, onAdd
, onDelete
, and onSelect
changed to allow disable. See pull 32. The default TRUE
now will pass the event to Shiny if in Shiny context.
jsoneditor
to 5.24.6
+ jsoneditor
to 5.24.6
react-json-view
to 2.5.7props
for react-json-view
reactjson()
to use react-json-view
instead of react-json
+reactjson()
to use react-json-view
instead of react-json
elementId
to the jsonedit
functionreact-json
to 0.2.1
+jsonedit_gadget
+number_unnamed
function (see issue)Output and render functions for using jsonedit within Shiny applications and interactive Rmd documents.
-jsoneditOutput(outputId, width = "100%", height = "400px") +- -+-renderJsonedit(expr, env = parent.frame(), quoted = FALSE)+jsoneditOutput(outputId, width = "100%", height = "400px") + +renderJsonedit(expr, env = parent.frame(), quoted = FALSE)
outputId | -output variable to read from |
-
---|---|
width, height | -Must be a valid CSS unit (like
+ Arguments+
|
-
expr | -An expression that generates a jsonedit |
-
env | -The environment in which to evaluate |
-
quoted | -Is |
-
'px'
appended.
- Lists
with 'jsoneditor'
— jsonedit • listviewerjsonedit
provides a flexible and helpful interactive tree-like view of lists
or really any R dataset that can be represented as JSON
.
Eventually, this could become a very nice way to not only view but also modify R data using
Shiny.
jsonedit(listdata = NULL, mode = "tree", modes = c("code", "form", - "text", "tree", "view"), ..., width = NULL, height = NULL, - elementId = NULL)- -
listdata | -
+
+
+
+ Arguments+
|
-
---|---|
mode | -
|
-
modes | -
|
-
... | -
|
-
width | -integer in pixels defining the width of the |
-
height | -integer in pixels defining the height of the |
-
elementId | -character to specify valid |
-
integer in pixels defining the width of the div
container.
-library(listviewer) - - # using the data from the jsoneditor simple example - # in R list form - jsonedit( - list( - array = c(1,2,3) - ,boolean = TRUE - ,null = NULL - ,number = 123 - ,object = list( a="b", c="d" ) - ,string = "Hello World" - ) - ) - - # jsonedit also works with a JSON string - jsonedit( - '{"array" : [1,2,3] , "boolean" : true, "null" : null, number = 123}' - ) - - # also works with most data.frames - jsonedit( mtcars ) - - # helpful interactive view of par - jsonedit( par() )
integer in pixels defining the height of the div
container.
character to specify valid CSS
id of the
+htmlwidget for special situations in which you want a non-random
+identifier.
library(listviewer)
+
+ # using the data from the jsoneditor simple example
+ # in R list form
+ jsonedit(
+ list(
+ array = c(1,2,3)
+ ,boolean = TRUE
+ ,null = NULL
+ ,number = 123
+ ,object = list( a="b", c="d" )
+ ,string = "Hello World"
+ )
+ )
+
+
+ # jsonedit also works with a JSON string
+ jsonedit(
+ '{"array" : [1,2,3] , "boolean" : true, "null" : null, "number": 123}'
+ )
+
+
+ # also works with most data.frames
+ jsonedit( mtcars )
+
+
+ # helpful interactive view of par
+ jsonedit( par() )
+
+
+