Nothing
#| include: FALSE pkgload::load_all()
Create a tstoml object from a string:
#| results: hide txt <- r"( # This is a TOML document title = "TOML Example" [owner] name = "Tom Preston-Werner" dob = 1979-05-27T07:32:00-08:00 [database] enabled = true ports = [ 8000, 8001, 8002 ] data = [ ["delta", "phi"], [3.14] ] temp_targets = { cpu = 79.5, case = 72.0 } [servers] [servers.alpha] ip = "10.0.0.1" role = "frontend" [servers.beta] ip = "10.0.0.2" role = "backend" )" toml <- ts_parse_toml(text = txt)
Pretty print a tstoml object:
#| label: print-toml toml
#| label: select-table ts_tree_select(toml, "owner")
Select element(s) inside elements:
#| label: select-select ts_tree_select(toml, "owner", "name")
Select element(s) of an array:
#| label: select-array ts_tree_select(toml, "database", "ports", 1:2)
Select multiple keys from a table:
#| label: select-multiple
ts_tree_select(toml, "owner", c("name", "dob"))
Delete selected elements:
#| label: delete-elements ts_tree_select(toml, "owner", "name") |> ts_tree_delete()
Insert a key-value pair into the document:
#| label: insert-pair-document ts_tree_insert(toml, key = "new_key", "new_value")
Insert a key-value pair into a table:
#| label: insert-pair-table ts_tree_select(toml, "owner") |> ts_tree_insert(key = "dpt", "Engineering")
Insert an element into an array:
#| label: insert-element-array ts_tree_select(toml, "database", "ports") |> ts_tree_insert(10000L) |> print(n = 100)
Insert a new table into the document:
#| label: insert-table-document ts_tree_insert(toml, key = "new_table", list(a = 1, b = 2)) |> print(n = 100)
Insert a new array of tables into the document:
#| label: insert-aot-document ts_tree_insert(toml, key = "new_aot", list(list(x = 1), list(x = 2))) |> print(n = 100)
Update an existing element:
#| label: update-element
ts_tree_select(toml, "title") |> ts_tree_update("A New TOML Example")
Update multiple elements at once:
#| label: update-multiple
ts_tree_select(toml, "servers", c("alpha", "beta"), "ip") |>
ts_tree_update("192.168.1.23") |>
print(n = 100)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.