Learn R Programming

listviewer (version 1.4.0)

reactjson: Edit R Data with 'react-json'

Description

Edit R Data with 'react-json'

Usage

reactjson(listdata = list(), width = NULL, height = NULL, elementId = NULL)

Arguments

listdata
list or String data to view. Although designed for lists, listdata can be any data source that can be rendered into JSON with jsonlite. Alternately, listdata could be a String of valid JSON. This might be helpful when dealing with an API response.
width
integer in pixels defining the width of the div container.
height
integer in pixels defining the height of the div container.
elementId
character to specify valid CSS id of the htmlwidget for special situations in which you want a non-random identifier.

Examples

Run this code
## Not run: 
# 
# library(listviewer)
# 
# # use reactR for React dependencies
# # devtools::install_github("timelyportfolio/reactR")
# library(reactR)
# 
# reactjson()
# 
# reactjson(head(mtcars,4))
# reactjson(I(jsonlite::toJSON(head(mtcars,5))))
# 
# library(shiny)
# 
# shinyApp(
#   ui = reactjson(
#     list(x=1,msg="react+r+shiny",opts=list(use_react=FALSE)),
#     elementId = "json1"
#   ),
#   server = function(input, output, session){
#     observeEvent(
#       input$json1_change,
#       str(input$json1_change)
#     )
#   }
# )
# 
# ## End(Not run)

Run the code above in your browser using DataLab