| Title: | Shiny Module for Taking Free-Form Notes |
|---|---|
| Description: | An enterprise-targeted scalable and customizable 'shiny' module providing an easy way to incorporate free-form note taking or discussion boards into applications. The package includes a 'shiny' module that can be included in any 'shiny' application to create a panel containing searchable, editable text broken down by section headers. Can be used with a local 'SQLite' database, or a compatible remote database of choice. |
| Authors: | Daniel Kovtun [cre, aut] |
| Maintainer: | Daniel Kovtun <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.2 |
| Built: | 2026-05-09 06:54:31 UTC |
| Source: | https://github.com/danielkovtun/shinynotes |
Wrapper function to return a
SQLiteConnection object for local development.
connect_sqlite(auto_disconnect = TRUE)connect_sqlite(auto_disconnect = TRUE)
auto_disconnect |
Should the connection be automatically closed when the
|
Returns an S4 object that inherits from DBIConnection. This object is
used to communicate with the database engine. Under the hood,
dbConnect() returns an object of class SQLiteConnection. See
dbConnect() for more details.
connect_sqlite()connect_sqlite()
Wrapper function to create a new schema in a SQLite database for local development.
create_schema(schema, con)create_schema(schema, con)
schema |
Schema name |
con |
A |
None. Executes SQL query and returns silently.
con <- connect_sqlite() create_schema(con, schema = "demo")con <- connect_sqlite() create_schema(con, schema = "demo")
Wrapper function to read table from default or custom schema,
and return NA by default if an error is encountered.
db.read_table(con, table, schema = NA, collect = TRUE, error_value = NA)db.read_table(con, table, schema = NA, collect = TRUE, error_value = NA)
con |
An object that inherits from
|
table |
A character string specifying the DBMS table name. |
schema |
A character string specifying the schema in which the table is nested. |
collect |
A logical specifying whether the query results should be collected into memory or left as a lazy query. |
error_value |
Error value to return if |
If the SQL query executes successfully, the return value will be an
object of class tibble. If an error is encountered,
the return value will be inherited from the error_value argument
provided (default is NA).
con <- connect_sqlite(auto_disconnect = FALSE) dplyr::copy_to(con, iris, "df", temporary = FALSE) db.read_table(con = con, table = 'df')con <- connect_sqlite(auto_disconnect = FALSE) dplyr::copy_to(con, iris, "df", temporary = FALSE) db.read_table(con = con, table = 'df')
Wrapper function to write data to table in default or custom
schema. Returns TRUE if successful, FALSE otherwise.
db.write_table( con, data, table, schema = NA, append_only = FALSE, drop_overwrite = NA )db.write_table( con, data, table, schema = NA, append_only = FALSE, drop_overwrite = NA )
con |
An object that inherits from
|
data |
A |
table |
A character string specifying the DBMS table name. |
schema |
A character string specifying the schema in which the table is nested. |
append_only |
A logical specifying whether the operation is
|
drop_overwrite |
A logical specifying whether the operation is
|
Returns TRUE if the SQL query executes successfully,
FALSE otherwise.
connection <- connect_sqlite(auto_disconnect = FALSE) db.write_table(con = connection, table = 'iris', data = iris)connection <- connect_sqlite(auto_disconnect = FALSE) db.write_table(con = connection, table = 'iris', data = iris)
shinynote module.A dataset containing package functions and their titles for the shiny, shinyWidgets and dplyr packages.
Formatted in a structure compatible with the shinyNotes::shinynotes module.
demo_notesdemo_notes
A tibble with 274 rows and 3 variables:
package title, character class
function name, character class
function title, character class
...
shinynote module.A dataset containing package functions and their titles for the shiny, shinyWidgets and dplyr packages.
Formatted in a structure compatible with the shinyNotes::shinynotes module.
emojisemojis
A named list of length 2 with elements of length 1510:
emoji name, character class
emoji image url, character class
...
shinynote module.A dataset containing examples of markdown syntax for including emojis, headers, and code blocks.
Formatted in a structure compatible with the shinyNotes::shinynotes module.
markdown_notesmarkdown_notes
A tibble with 3 rows and 3 variables:
text format type, character class
type of markdown formatter, character class
text with markdown syntax, character class
...
Launch a rpredictit example Shiny app that shows how to
easily use shinyNotes in a Shiny app.
Run without any arguments to see a list of available example apps.
runExample(example)runExample(example)
example |
The app to launch |
None. Runs a demo Shiny application. This function normally does not return; interrupt R to stop the application.
## Only run this example in interactive R sessions if (interactive()) { # List all available example apps runExample() runExample("demo") }## Only run this example in interactive R sessions if (interactive()) { # List all available example apps runExample() runExample("demo") }
Server function for the shinynotes module.
shinynotes( input, output, session, group_column, selected_group, group_options, table_id, db_conn, category_options = NA, style_options = default_styles() )shinynotes( input, output, session, group_column, selected_group, group_options, table_id, db_conn, category_options = NA, style_options = default_styles() )
input |
Standard |
output |
Standard |
session |
Standard |
group_column |
Column in table to group and filter notes by. |
selected_group |
Currently selected group column value. |
group_options |
Group column row value options. |
table_id |
Named list with member 'table' and 'schema' referring to a database table containing notes. |
db_conn |
An object that inherits from
|
category_options |
Category column row value options. Useful if table is
empty. Default is |
style_options |
Optional named list of |
The style_options argument contains the following default
values:
type = "paragraph"
header
color = "#4b2c71"
style = "font-weight: bold; text-decoration: underline;"
panel
status = "default"
background = "#fdfeff"
scrollY = "scroll"
max_height = "600px"
height = "100
padding = "4px"
width = "100
border_width = "2px"
border_radius = "4px"
border_style = "solid"
border_color = "#f5f5f5"
style = "text-align:left; margin-right:1px;"
paragraph_style = "margin: 0px 0px 1px;white-space: pre-wrap;"
bullet_style = "white-space: pre-wrap;"
hr_style = "margin-top:10px; margin-bottom:10px;"
ignoreCase = TRUE
Module server component. Reactive expression containing the currently selected note data and database connection.
if(interactive()){ shiny::callModule( module = shinynotes, id = "paragraph", style_options = shiny::reactive({ list( "type" = "bullets", "header" = list("color" = "#ccc"), "panel" = list("scrollY" = TRUE) ) }), group_column = "package", selected_group = shiny::reactive("shiny"), group_options = c("shiny", "shinyWidgets", "dplyr"), table_id = list(table = "scroll_demo", schema = "notes"), db_conn = connect_sqlite(auto_disconnect = FALSE) ) }if(interactive()){ shiny::callModule( module = shinynotes, id = "paragraph", style_options = shiny::reactive({ list( "type" = "bullets", "header" = list("color" = "#ccc"), "panel" = list("scrollY" = TRUE) ) }), group_column = "package", selected_group = shiny::reactive("shiny"), group_options = c("shiny", "shinyWidgets", "dplyr"), table_id = list(table = "scroll_demo", schema = "notes"), db_conn = connect_sqlite(auto_disconnect = FALSE) ) }
UI function for the shinynotes module.
shinynotesUI(id)shinynotesUI(id)
id |
An ID string that will be used to assign the module's namespace. |
Note module UI, containing note panel and control buttons. An HTML
tag object that can be rendered as HTML using
as.character().
if(interactive()){ shinynotesUI(id = 'paragraph') }if(interactive()){ shinynotesUI(id = 'paragraph') }