Commit 1742ff44 authored by wuzekai's avatar wuzekai

Initial commit

parents
FROM rocker/shiny:4.5.1
RUN apt-get update && apt-get install -y \
libxml2-dev libssl-dev libcurl4-openssl-dev \
libharfbuzz-dev libfribidi-dev libfreetype6-dev \
libpng-dev libtiff5-dev libjpeg-dev \
&& rm -rf /var/lib/apt/lists/*
RUN R -e "install.packages(c('shiny', 'shinydashboard', 'remotes'), repos='https://cran.rstudio.com/')"
COPY . /srv/shiny-server/
COPY set_path.R /usr/local/lib/R/etc/Rprofile.site.d/00-radiant-path.R
# 安装所有子模块
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.data', type='source', upgrade='never')"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.basics', type='source', upgrade='never')"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.model', type='source', upgrade='never')"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.multivariate', type='source', upgrade='never')"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.design', type='source', upgrade='never')"
RUN R -e "remotes::install_local('/srv/shiny-server/radiant.quickgen', type='source', upgrade='never')"
# 安装主 radiant 应用
RUN R -e "remotes::install_local('/srv/shiny-server/radiant-master', type='source', upgrade='never')"
WORKDIR /data
CMD ["R", "-e", "radiant::radiant(host='0.0.0.0', port=3838)"]
\ No newline at end of file
name,alignment,gender,publisher Thor,good,male,Marvel Iron Man,good,male,Marvel Hulk,good,male,Marvel Hawkeye,good,male,Marvel Black Widow,good,female,Marvel Captain America,good,male,Marvel Magneto,bad,male,Marvel
\ No newline at end of file
name,alignment,gender,publisher Magneto,bad,male,Marvel Storm,good,female,Marvel Mystique,bad,female,Marvel Batman,good,male,DC Joker,bad,male,DC Catwoman,bad,female,DC Hellboy,good,male,Dark Horse Comics
\ No newline at end of file
^CRAN-RELEASE$
^.*\.Rproj$
^\.Rproj\.user$
^\.travis\.yml$
^docs$
^inst/app/tests$
cran-comments.md
radiant.code-workspace
.vscode
^CRAN-SUBMISSION$
.codespellrc
.github
[codespell]
skip = .git,*.pdf,*.svg,programming.html
# rady - server/domain name
ignore-words-list = rady
---
name: Codespell
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v1
.Rproj.user
.Rhistory
.RData
.Ruserdata
inst/doc
.DS_Store
radiant.Rproj
^inst/app/tests$
radiant.dcf
.vscode
language: r
r:
- oldrel
- release
- devel
warnings_are_errors: true
sudo: required
dist: trusty
r_packages:
- devtools
r_github_packages:
- trestletech/shinyAce
- radiant-rstats/radiant.data
- radiant-rstats/radiant.design
- radiant-rstats/radiant.basics
- radiant-rstats/radiant.model
- radiant-rstats/radiant.multivariate
This package was submitted to CRAN on 2021-05-13.
Once it is accepted, delete this file and tag the release (commit d5d2dba).
Version: 1.6.6
Date: 2024-05-15 02:39:50 UTC
SHA: 978ce76e1fed998a830076d7e47dde638a4f7d1d
Package: radiant
Type: Package
Title: Business Analytics using R and Shiny
Version: 1.6.6
Date: 2024-5-20
Authors@R: person("Vincent", "Nijs", , "radiant@rady.ucsd.edu", c("aut", "cre"))
Description: A platform-independent browser-based interface for business
analytics in R, based on the shiny package. The application combines the
functionality of 'radiant.data', 'radiant.design', 'radiant.basics',
'radiant.model', and 'radiant.multivariate'.
Depends:
R (>= 4.3.0),
radiant.data (>= 1.6.6),
radiant.design (>= 1.6.6),
radiant.basics (>= 1.6.6),
radiant.model (>= 1.6.6),
radiant.multivariate (>= 1.6.6)
Imports:
shiny (>= 1.8.1),
import (>= 1.1.0),
shiny.i18n
Suggests:
testthat (>= 2.0.0),
knitr,
rmarkdown,
markdown (>= 1.3)
URL: https://github.com/radiant-rstats/radiant
BugReports: https://github.com/radiant-rstats/radiant/issues
License: AGPL-3 | file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Radiant is licensed under AGPL3 (see https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0) and https://www.r-project.org/Licenses/AGPL-3). The radiant help files are licensed under the creative commons attribution, non-commercial, share-alike license CC-NC-SA (https://creativecommons.org/licenses/by-nc-sa/4.0/).
As a summary, the AGPLv3 license requires, attribution, including copyright and license information in copies of the software, stating changes if the code is modified, and disclosure of all source code. Details are in the COPYING file.
If you are interested in using Radiant please email me at radiant@rady.ucsd.edu
ALL HELPFILES IN THE RADIANT APPLICATION USE THE FOLLOWING LICENSE (https://creativecommons.org/licenses/by-nc-sa/4.0/)
========================================================================================================================
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 – Definitions.
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 – Scope.
License grant.
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
Term. The term of this Public License is specified in Section 6(a).
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
Downstream recipients.
Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
Other rights.
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
Patent and trademark rights are not licensed under this Public License.
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
Section 3 – License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
Attribution.
If You Share the Licensed Material (including in modified form), You must:
retain the following if it is supplied by the Licensor with the Licensed Material:
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
a copyright notice;
a notice that refers to this Public License;
a notice that refers to the disclaimer of warranties;
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
ShareAlike.
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
Section 4 – Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 – Disclaimer of Warranties and Limitation of Liability.
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 – Term and Termination.
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 – Other Terms and Conditions.
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 – Interpretation.
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
# Generated by roxygen2: do not edit by hand
export(launcher)
export(lin_launcher)
export(mac_launcher)
export(radiant)
export(radiant_url)
export(radiant_viewer)
export(radiant_window)
export(win_launcher)
import(radiant.basics)
import(radiant.data)
import(radiant.design)
import(radiant.model)
import(radiant.multivariate)
import(shiny)
importFrom(import,from)
importFrom(radiant.data,launch)
importFrom(utils,new.packages)
# radiant 1.6.6.0
* Require Shiny 1.8.1. Adjustments related to icon-buttons were made to address a breaking change in Shiny 1.8.1
* Reverting changes that removed `req(input$dataset)` in different places
# radiant 1.6.1.0
* Require shiny 1.8.0. This fixes a bug in the shiny 1.7 versions that caused issues with all radiant packages
# radiant 1.6.0.0
* Using "Radiant for R" in UI to differentiate from "Radiant for Python"
* Addressed a package documentation issue due to a change in roxygen2
# radiant 1.5.0.0
* Required 1.5.0 of all radiant packages to ensure users can access the new functionality added to other radiant packages
# radiant 1.4.4.0
* Required 1.4.4 of all radiant packages (1.4.6 for radiant.model) to ensure users can create screenshots of application settings in the shiny interface for all radiant modules
# radiant 1.4.2.0
* Documentation updates
* Fix and improvements for launcher issue on windows, mac, and linux when not using Rstudio. Will pickup Quarto (Pandoc) if installed
# radiant 1.4.0.0
* Adding the markdown package to `suggests` fixes https://github.com/radiant-rstats/radiant/issues/153
# radiant 1.3.1.0
* Added launch option that only shows a URL. Convenient for VSCode to launch Radiant in an external browser
* Using `polycor::hetcor` to calculate measures of correlation between numeric and categorical variables
* Using `patchwork` to combine multiple plots
# radiant 1.2.0.0
* Documentation updates
* Upgrade dependency to shiny 1.4.0
* Improved handling of fractions in radiant.design, radiant.basics, and radiant.model
* Improved button refresh code when relevant inputs are changed by the user
# radiant 1.1.0.0
* Numerous small code changes to support enhanced auto-completion, tooltips, and annotations in shinyAce 0.4.1
# radiant 0.9.9.0
* Option to pass additional arguments to `shiny::runApp` when starting radiant such as the port to use. For example, radiant::radiant("https://github.com/radiant-rstats/docs/raw/gh-pages/examples/demo-dvd-rnd.state.rda", port = 8080)
* Load a state file on startup by providing a (relative) file path or a url. For example, radiant::radiant("https://github.com/radiant-rstats/docs/raw/gh-pages/examples/demo-dvd-rnd.state.rda")
* Update dependencies and convert all package data to tibbles
# radiant 0.9.6.0
* Remove `rstudioapi`, `psych`, and `AlgDesign` as a direct imports
# radiant 0.9.5.0
## Major changes
* When using radiant with Rstudio Viewer or in an Rstudio Window, loading and saving data through _Data > Manage_ generates R-code the user can add to _Report > Rmd_ or _Report > R_. Clicking the `Show R-code` checkbox displays the R-code used to load or save the current dataset
* Added `load_clip` and `save_clip` to load and save data to the clipboard on Windows and macOS
* Various changes to the code to accommodate the use of `shiny::makeReactiveBinding`. The advantage is that the code generated for _Report > Rmd_ and _Report > R_ will no longer have to use `r_data` to store and access data. This means that code generated and used in the Radiant browser interface will be directly usable without the browser interface as well.
* Improved auto completion in _Report > Rmd_ and _Report > R_
# radiant 0.9.2.0
## Major changes
* `Esitmate model` buttons update when model input changes so the user know to re-estimate the model
* Upload and download data using the Rstudio file browser. Allows using relative paths to files (e.g., data or images inside an Rstudio project)
* Moved `update_radiant` function to a separate package. The new function is radiant.update::radiant.update() and can be installed using:
install.packages("radiant.update", repos = "https://radiant-rstats.github.io/minicran/")
## Minor changes
* Addins option to start app in Rstudio window
# radiant 0.9.0.0
## Minor changes
* Addins to launch in default browser or Rstudio viewer
* Improved `update_radiant` function for Windows and Mac
* Suppress package start-up messages
* Show Rstudio project information in navbar if available
* Option to start Radiant in Browser or Rstudio Viewer
* Applied `styler` to code
# radiant 0.8.7.4
## Minor changes
* Upgraded tidyr dependency to 0.7
* Upgraded dplyr dependency to 0.7.1
# radiant VERSION 0.8.2
## Minor changes
Updated dependency requirements for radiant menus contained in packages radiant.data, radiant.design, radiant.basics, radiant.model, and radiant.multivariate. See the NEWS.md files for those packages for additional information about changes.
# radiant VERSION 0.8.1
## Minor changes
* Added a check to see if radiant::update_radiant() is running in Rstudio
* Updated dependency requirements for radiant menus contained in packages radiant.data, radiant.design, radiant.basics, radiant.model, and radiant.multivariate. See the NEWS.md files for those packages for additional information about changes.
globalVariables(".rs.restartR")
#' radiant
#'
#' @name radiant
#' @import radiant.data radiant.design radiant.basics radiant.model radiant.multivariate shiny
#' @importFrom import from
#' @importFrom utils new.packages
NULL
#' Launch radiant in the default browser
#'
#' @description Launch radiant in the default web browser
#' @details See \url{https://radiant-rstats.github.io/docs/} for documentation and tutorials
#'
#' @param state Path to state file to load
#' @param ... additional arguments to pass to shiny::runApp (e.g, port = 8080)
#'
#' @importFrom radiant.data launch
#'
#' @examples
#' \dontrun{
#' radiant()
#' radiant("https://github.com/radiant-rstats/docs/raw/gh-pages/examples/demo-dvd-rnd.state.rda")
#' }
#' @export
radiant <- function(state, ...) radiant.data::launch(package = "radiant", run = "browser", state, ...)
#' Launch radiant in an Rstudio window
#'
#' @param state Path to state file to load
#' @param ... additional arguments to pass to shiny::runApp (e.g, port = 8080)
#'
#' @details See \url{https://radiant-rstats.github.io/docs/} for documentation and tutorials
#'
#' @importFrom radiant.data launch
#'
#' @examples
#' \dontrun{
#' radiant_window()
#' }
#' @export
radiant_window <- function(state, ...) radiant.data::launch(package = "radiant", run = "window", state, ...)
#' Launch radiant in the Rstudio viewer
#'
#' @details See \url{https://radiant-rstats.github.io/docs/} for documentation and tutorials
#'
#' @param state Path to state file to load
#' @param ... additional arguments to pass to shiny::runApp (e.g, port = 8080)
#'
#' @importFrom radiant.data launch
#'
#' @examples
#' \dontrun{
#' radiant_viewer()
#' }
#' @export
radiant_viewer <- function(state, ...) radiant.data::launch(package = "radiant", run = "viewer", state, ...)
#' Start radiant but do not open a browser
#'
#' @param state Path to statefile to load
#' @param ... additional arguments to pass to shiny::runApp (e.g, port = 8080)
#'
#' @examples
#' \dontrun{
#' radiant_url()
#' }
#' @export
radiant_url <- function(state, ...) radiant.data::launch(package = "radiant", run = FALSE, state, ...)
#' Create a launcher and updater for Windows (.bat)
#'
#' @details On Windows a file named 'radiant.bat' and one named 'update_radiant.bat' will be put on the desktop. Double-click the file to launch the specified Radiant app or update Radiant to the latest version
#'
#' @param app App to run when the desktop icon is double-clicked ("radiant", "radiant.data", etc.). Default is "radiant"
#' @param port Port to use for shiny::runApp (e.g, port = 4444)
#' @param pdir Project directory to use. Default is Sys.getenv("HOME")
#'
#' @examples
#' \dontrun{
#' radiant::win_launcher()
#' }
#'
#' @export
win_launcher <- function(app = c("radiant", "radiant.data", "radiant.design", "radiant.basics", "radiant.model", "radiant.multivariate"), port = 4444, pdir = Sys.getenv("HOME")) {
if (!interactive()) stop("This function can only be used in an interactive R session")
if (Sys.info()["sysname"] != "Windows") {
return(message("This function is for Windows only. For Mac use the mac_launcher() function"))
}
answ <- readline("Do you want to create shortcuts for Radiant on your Desktop? (y/n) ")
if (substr(answ, 1, 1) %in% c("y", "Y")) {
local_dir <- Sys.getenv("R_LIBS_USER")
if (!file.exists(local_dir)) dir.create(local_dir, recursive = TRUE)
pt <- file.path(Sys.getenv("HOME"), "Desktop")
if (!file.exists(pt)) {
pt <- file.path(Sys.getenv("USERPROFILE"), "Desktop", fsep = "\\")
}
if (!file.exists(pt)) {
pt <- Sys.getenv("HOME")
message(paste0("The launcher function was unable to find your Desktop. The launcher and update files/icons will be put in the directory: ", pt))
}
pt <- normalizePath(pt, winslash = "/")
if (rmarkdown::pandoc_available()) {
rsp <- Sys.getenv("RSTUDIO_PANDOC")
rsp <- paste0("Sys.setenv(RSTUDIO_PANDOC='", rsp, "');")
} else {
rsp <- ""
}
fn1 <- file.path(pt, "radiant.bat")
launch_string <- paste0("\"", Sys.which("R"), "\" -e \"setwd('", normalizePath(pdir, winslash = "/"), "'); options(radiant.launch_dir = normalizePath(getwd())); if (!require(radiant)) { install.packages('radiant', repos = 'https://radiant-rstats.github.io/minicran/', type = 'binary') }; ", rsp, "library(radiant); shiny::runApp(system.file('app', package='", app[1], "'), port = ", port, ", launch.browser = TRUE)\"")
cat(launch_string, file = fn1, sep = "\n")
Sys.chmod(fn1, mode = "0755")
fn2 <- file.path(pt, "update_radiant.bat")
launch_string <- paste0("\"", Sys.which("R"), "\" -e \"unlink('~/.radiant.sessions/*.rds', force = TRUE); install.packages('radiant', repos = 'https://radiant-rstats.github.io/minicran/', type = 'binary'); suppressWarnings(update.packages(lib.loc = .libPaths()[1], repos = 'https://radiant-rstats.github.io/minicran', ask = FALSE, type = 'binary'))\"\npause(1000)")
cat(launch_string, file = fn2, sep = "\n")
Sys.chmod(fn2, mode = "0755")
if (file.exists(fn1) && file.exists(fn2)) {
message("Done! Look for a file named radiant.bat on your desktop. Double-click it to start Radiant in your default browser. There is also a file called update_radiant.bat you can double click to update the version of Radiant on your computer.\n")
} else {
message("Something went wrong. No shortcuts were created.")
}
} else {
message("No shortcuts were created.\n")
}
}
#' Create a launcher and updater for Mac (.command)
#'
#' @details On Mac a file named 'radiant.command' and one named 'update_radiant.command' will be put on the desktop. Double-click the file to launch the specified Radiant app or update Radiant to the latest version
#'
#' @param app App to run when the desktop icon is double-clicked ("radiant", "radiant.data", etc.). Default is "radiant"
#' @param port Port to use for shiny::runApp (e.g, port = 4444)
#' @param pdir Project directory to use. Default is Sys.getenv("HOME")
#'
#' @examples
#' \dontrun{
#' radiant::mac_launcher()
#' }
#'
#' @export
mac_launcher <- function(app = c("radiant", "radiant.data", "radiant.design", "radiant.basics", "radiant.model", "radiant.multivariate"), port = 4444, pdir = Sys.getenv("HOME")) {
if (!interactive()) stop("This function can only be used in an interactive R session")
if (Sys.info()["sysname"] != "Darwin") {
return(message("This function is for Mac only. For windows use the win_launcher() function"))
}
answ <- readline("Do you want to create shortcuts for Radiant on your Desktop? (y/n) ")
if (substr(answ, 1, 1) %in% c("y", "Y")) {
local_dir <- Sys.getenv("R_LIBS_USER")
if (!file.exists(local_dir)) dir.create(local_dir, recursive = TRUE)
if (rmarkdown::pandoc_available()) {
rsp <- Sys.getenv("RSTUDIO_PANDOC")
rsp <- paste0("Sys.setenv(RSTUDIO_PANDOC='", rsp, "');")
} else {
rsp <- ""
}
fn1 <- paste0("/Users/", Sys.getenv("USER"), "/Desktop/radiant.command")
launch_string <- paste0("#!/usr/bin/env Rscript\nsetwd('", pdir, "')\noptions(radiant.launch_dir = normalizePath(getwd()))\nif (!require(radiant)) {\n install.packages('radiant', repos = 'https://radiant-rstats.github.io/minicran/', type = 'binary')\n}\n", rsp, "\nlibrary(radiant)\nshiny::runApp(system.file('app', package='", app[1], "'), port = ", port, ", launch.browser = TRUE)\n")
cat(launch_string, file = fn1, sep = "\n")
Sys.chmod(fn1, mode = "0755")
fn2 <- paste0("/Users/", Sys.getenv("USER"), "/Desktop/update_radiant.command")
launch_string <- paste0("#!/usr/bin/env Rscript\nunlink('~/.radiant.sessions/*.rds', force = TRUE)\ninstall.packages('radiant', repos = 'https://radiant-rstats.github.io/minicran/', type = 'binary')\nsuppressWarnings(update.packages(lib.loc = .libPaths()[1], repos = 'https://radiant-rstats.github.io/minicran', ask = FALSE, type = 'binary'))\nSys.sleep(1000)")
cat(launch_string, file = fn2, sep = "\n")
Sys.chmod(fn2, mode = "0755")
if (file.exists(fn1) && file.exists(fn2)) {
message("Done! Look for a file named radiant.command on your desktop. Double-click it to start Radiant in your default browser. There is also a file called update_radiant.command you can double click to update the version of Radiant on your computer.\n")
} else {
message("Something went wrong. No shortcuts were created.")
}
} else {
message("No shortcuts were created.\n")
}
}
#' Create a launcher and updater for Linux (.sh)
#'
#' @details On Linux a file named 'radiant.sh' and one named 'update_radiant.sh' will be put on the desktop. Double-click the file to launch the specified Radiant app or update Radiant to the latest version
#'
#' @param app App to run when the desktop icon is double-clicked ("radiant", "radiant.data", etc.). Default is "radiant"
#' @param port Port to use for shiny::runApp (e.g, port = 4444)
#' @param pdir Project directory to use. Default is Sys.getenv("HOME")
#'
#' @examples
#' \dontrun{
#' radiant::lin_launcher("radiant")
#' }
#'
#' @export
lin_launcher <- function(app = c("radiant", "radiant.data", "radiant.design", "radiant.basics", "radiant.model", "radiant.multivariate"), port = 4444, pdir = Sys.getenv("HOME")) {
if (!interactive()) stop("This function can only be used in an interactive R session")
if (Sys.info()["sysname"] != "Linux") {
return(message("This function is for Linux only. For windows use the win_launcher() function and for mac use the mac_launcher() function"))
}
answ <- readline("Do you want to create shortcuts for Radiant on your Desktop? (y/n) ")
if (substr(answ, 1, 1) %in% c("y", "Y")) {
local_dir <- Sys.getenv("R_LIBS_USER")
if (!file.exists(local_dir)) dir.create(local_dir, recursive = TRUE)
if (rmarkdown::pandoc_available()) {
rsp <- Sys.getenv("RSTUDIO_PANDOC")
rsp <- paste0("Sys.setenv(RSTUDIO_PANDOC='", rsp, "');")
} else {
rsp <- ""
}
fn1 <- paste0("/Users/", Sys.getenv("USER"), "/Desktop/radiant.sh")
launch_string <- paste0("#!/usr/bin/env Rscript\nsetwd('", pdir, "')\noptions(radiant.launch_dir = normalizePath(getwd()))\nif (!require(radiant)) {\n install.packages('radiant', repos = 'https://https://packagemanager.posit.co/all/__linux__/focal/latest')\n}\n", rsp, "\nlibrary(radiant)\nshiny::runApp(system.file('app', package='", app[1], "'), port = ", port, ", launch.browser = TRUE)\n")
cat(launch_string, file = fn1, sep = "\n")
Sys.chmod(fn1, mode = "0755")
fn2 <- paste0(Sys.getenv("HOME"), "/Desktop/update_radiant.sh")
launch_string <- paste0("#!/usr/bin/env Rscript\nunlink('~/.radiant.sessions/*.rds', force = TRUE)\ninstall.packages('radiant', repos = 'https://radiant-rstats.github.io/minicran/')\nsuppressWarnings(update.packages(lib.loc = .libPaths()[1], repos = 'https://radiant-rstats.github.io/minicran', ask = FALSE))\nSys.sleep(1000)")
cat(launch_string, file = fn2, sep = "\n")
Sys.chmod(fn2, mode = "0755")
if (file.exists(fn1) && file.exists(fn2)) {
message("Done! Look for a file named radiant.sh on your desktop. Double-click it to start Radiant in your default browser. There is also a file called update_radiant.sh you can double click to update the version of Radiant on your computer.\n\nIf the .sh files are opened in a text editor when you double-click them go to File Manager > Edit > Preferences > Behavior and click 'Run executable text files when they are opened'.")
} else {
message("Something went wrong. No shortcuts were created.")
}
} else {
message("No shortcuts were created.\n")
}
}
#' Create a launcher on the desktop for Windows (.bat), Mac (.command), or Linux (.sh)
#'
#' @details On Windows/Mac/Linux a file named radiant.bat/radiant.command/radiant.sh will be put on the desktop. Double-click the file to launch the specified Radiant app
#'
#' @seealso \code{\link{win_launcher}} to create a shortcut on Windows
#' @seealso \code{\link{mac_launcher}} to create a shortcut on Mac
#' @seealso \code{\link{lin_launcher}} to create a shortcut on Linux
#'
#' @param app App to run when the desktop icon is double-clicked ("analytics", "marketing", "quant", or "base"). Default is "analytics"
#' @param port Port to use for shiny::runApp (e.g, port = 4444)
#' @param pdir Project directory to use. Default is Sys.getenv("HOME")
#'
#' @examples
#' \dontrun{
#' radiant::launcher("radiant.model")
#' }
#'
#' @export
launcher <- function(app = c("radiant", "radiant.data", "radiant.design", "radiant.basics", "radiant.model", "radiant.multivariate"), port = 4444, pdir = Sys.getenv("HOME")) {
os <- Sys.info()["sysname"]
if (os == "Darwin") {
mac_launcher(app[1], port = port, pdir = pdir)
} else if (os == "Windows") {
win_launcher(app[1], port = port, pdir = pdir)
} else if (os == "Linux") {
lin_launcher(app[1], port = port, pdir = pdir)
} else {
return(message("This function is not available for your platform."))
}
}
# Radiant - Business analytics using R and Shiny
<!-- [![Build Status](https://travis-ci.org/radiant-rstats/radiant.png?branch=master)](https://travis-ci.org/radiant-rstats/radiant) -->
<!-- [![Coverage Status](https://img.shields.io/coveralls/vnijs/radiant.svg)](https://coveralls.io/r/vnijs/radiant?branch=master) -->
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/radiant)](https://CRAN.R-project.org/package=radiant)
Radiant is an open-source platform-independent browser-based interface for business analytics in [R](https://www.r-project.org/). The application is based on the [Shiny](https://shiny.posit.co/) package and can be run locally or on a server. Radiant was developed by <a href="https://rady.ucsd.edu/faculty-research/faculty/vincent-nijs.html" target="\_blank">Vincent Nijs</a>. Please use the issue tracker on GitHub to suggest enhancements or report problems: https://github.com/radiant-rstats/radiant/issues. For other questions and comments please use radiant@rady.ucsd.edu.
## Key features
- Explore: Quickly and easily summarize, visualize, and analyze your data
- Cross-platform: It runs in a browser on Windows, Mac, and Linux
- Reproducible: Recreate results and share work with others as a state file or an [Rmarkdown](https://rmarkdown.rstudio.com/) report
- Programming: Integrate Radiant's analysis functions with your own R-code
- Context: Data and examples focus on business applications
<iframe width="640" height="375" src="https://www.youtube.com/embed/7L3hDpLw53I" frameborder="0" allowfullscreen></iframe>
#### Playlists
There are two youtube playlists with video tutorials. The first provides a general introduction to key features in Radiant. The second covers topics relevant in a course on business analytics (i.e., Probability, Decision Analysis, Hypothesis Testing, Linear Regression, and Simulation).
* <a href="https://www.youtube.com/playlist?list=PLNhtaetb48EedDmWPUqytnQv-qxmCGtxi" target="_blank">Introduction to Radiant</a>
* <a href="https://www.youtube.com/playlist?list=PLNhtaetb48EdKRIY7MewCyvb_1x7dV3xw" target="_blank">Radiant Tutorial Series</a>
#### Explore
Radiant is interactive. Results update immediately when inputs are changed (i.e., no separate dialog boxes) and/or when a button is pressed (e.g., `Estimate` in _Model > Estimate > Logistic regression (GLM)_). This facilitates rapid exploration and understanding of the data.
#### Cross-platform
Radiant works on Windows, Mac, or Linux. It can run without an Internet connection and no data will leave your computer. You can also run the app as a web application on a server.
#### Reproducible
To conduct high-quality analysis, simply saving output is not enough. You need the ability to reproduce results for the same data and/or when new data become available. Moreover, others may want to review your analysis and results. Save and load the state of the application to continue your work at a later time or on another computer. Share state files with others and create reproducible reports using [Rmarkdown](https://rmarkdown.rstudio.com/). See also the section on `Saving and loading state` below
If you are using Radiant on a server you can even share the URL (include the SSUID) with others so they can see what you are working on. Thanks for this feature go to [Joe Cheng](https://github.com/jcheng5).
#### Programming
Although Radiant's web-interface can handle quite a few data and analysis tasks, you may prefer to write your own R-code. Radiant provides a bridge to programming in R(studio) by exporting the functions used for analysis (i.e., you can conduct your analysis using the Radiant web-interface or by calling Radiant's functions directly from R-code). For more information about programming with Radiant see the [programming](https://radiant-rstats.github.io/docs/programming.html) page on the documentation site.
#### Context
Radiant focuses on business data and decisions. It offers tools, examples, and documentation relevant for that context, effectively reducing the business analytics learning curve.
## How to install Radiant
- Required: [R](https://cran.r-project.org/) version 4.0.0 or later
- Required: [Rstudio](https://posit.co/download/rstudio-server/)
In Rstudio you can start and update Radiant through the `Addins` menu at the top of the screen. To install the latest version of Radiant for Windows or Mac, with complete documentation for off-line access, open R(studio) and copy-and-paste the command below:
```r
options(repos = c(RSM = "https://radiant-rstats.github.io/minicran", CRAN = "https://cloud.r-project.org"))
install.packages("radiant")
```
Once all packages are installed, select `Start radiant` from the `Addins` menu in Rstudio or use the command below to launch the app:
```r
radiant::radiant()
```
To launch Radiant in Rstudio's viewer pane use the command below:
```r
radiant::radiant_viewer()
```
To launch Radiant in an Rstudio Window use the command below:
```r
radiant::radiant_window()
```
To easily update Radiant and the required packages, install the `radiant.update` package using:
```r
options(repos = c(RSM = "https://radiant-rstats.github.io/minicran", CRAN = "https://cloud.r-project.org"))
install.packages("remotes")
remotes::install_github("radiant-rstats/radiant.update", upgrade = "never")
```
Then select `Update radiant` from the `Addins` menu in Rstudio or use the command below:
```r
radiant.update::radiant.update()
```
See the [installing radiant](https://radiant-rstats.github.io/docs/install.html) page additional for details.
**Optional:** You can also create a launcher on your Desktop to start Radiant by typing `radiant::launcher()` in the R(studio) console and pressing return. A file called `radiant.bat` (windows) or `radiant.command` (mac) will be created that you can double-click to start Radiant in your default browser. The `launcher` command will also create a file called `update_radiant.bat` (windows) or `update_radiant.command` (mac) that you can double-click to update Radiant to the latest release.
When Radiant starts you will see data on diamond prices. To close the application click the <i title='Power off' class='fa fa-power-off'></i> icon in the navigation bar and then click `Stop`. The Radiant process will stop and the browser window will close (Chrome) or gray-out.
## Documentation
Documentation and tutorials are available at <https://radiant-rstats.github.io/docs/> and in the Radiant web interface (the <i title='Help' class='fa fa-question'></i> icons on each page and the <i title='Help' class='fa fa-question-circle'></i> icon in the navigation bar).
Individual Radiant packages also each have their own [pkgdown](https://github.com/r-lib/pkgdown) sites:
* http://radiant-rstats.github.io/radiant
* http://radiant-rstats.github.io/radiant.data
* http://radiant-rstats.github.io/radiant.design
* http://radiant-rstats.github.io/radiant.basics
* http://radiant-rstats.github.io/radiant.model
* http://radiant-rstats.github.io/radiant.multivariate
Want some help getting started? Watch the tutorials on the [documentation site](https://radiant-rstats.github.io/docs/tutorials.html).
## Reporting issues
Please use the GitHub issue tracker at <a href="https://github.com/radiant-rstats/radiant/issues" target="_blank">github.com/radiant-rstats/radiant/issues</a> if you have any problems using Radiant.
## Try Radiant online
Not ready to install Radiant on your computer? Try it online at the link below:
<a href="https://vnijs.shinyapps.io/radiant" target="_blank">https://vnijs.shinyapps.io/radiant</a>
Do **not** upload sensitive data to this public server. The size of data upload has been restricted to 10MB for security reasons.
## Running Radiant on shinyapps.io
To run your own instance of Radiant on shinyapps.io first <a href = "https://radiant-rstats.github.io/docs/install.html" target = "_blank">install Radiant and its dependencies</a>. Then clone the <a href="https://github.com/radiant-rstats/radiant" target="_blank">radiant</a> repo and ensure you have the latest version of the Radiant packages installed by running `radiant/inst/app/for.shinyapps.io.R`. Finally, open `radiant/inst/app/ui.R` and [deploy](https://shiny.posit.co/articles/shinyapps.html) the application.
## Running Radiant on shiny-server
You can also host Radiant using [shiny-server](https://posit.co/download/shiny-server/). First, install radiant on the server using the command below:
```r
options(repos = c(RSM = "https://radiant-rstats.github.io/minicran", CRAN = "https://cloud.r-project.org"))
install.packages("radiant")
```
Then clone the <a href="https://github.com/radiant-rstats/radiant" target="_blank">radiant</a> repo and point shiny-server to the `inst/app/` directory. As a courtesy, please let me know if you intend to use Radiant on a server.
When running Radiant on a server, by default, file uploads are limited to 10MB and R-code in _Report > Rmd_ and _Report > R_ will not be evaluated for security reasons. If you have `sudo` access to the server and have appropriate security in place you can change these settings by adding the following lines to `.Rprofile` for the `shiny` user on the server.
```bash
options(radiant.maxRequestSize = -1) ## no file size limit
options(radiant.report = TRUE)
```
## Running Radiant in the cloud (e.g., AWS)
To run radiant in the cloud you can use the customized Docker container. See <a href = "https://github.com/radiant-rstats/docker" target="_blank">https://github.com/radiant-rstats/docker</a> for details
## Saving and loading state
To save your analyses save the state of the app to a file by clicking on the <i title='Save' class='fa fa-save'></i> icon in the navbar and then on `Save radiant state file` (see also the _Data > Manage_ tab). You can open this state file at a later time or on another computer to continue where you left off. You can also share the file with others that may want to replicate your analyses. As an example, load the state file [`radiant-example.state.rda`](https://radiant-rstats.github.io/docs/examples/radiant-example.state.rda) by clicking on the <i title='Save' class='fa fa-save'></i> icon in the navbar and then on `Load radiant state file`. Go to _Data > View_ and _Data > Visualize_ to see some of the settings from the previous "state" of the app. There is also a report in _Report > Rmd_ that was created using the Radiant interface. The html file <a href="https://radiant-rstats.github.io/docs/examples/radiant-example.nb.html" target="_blank">`radiant-example.nb.html`</a> contains the output.
A related feature in Radiant is that state is maintained if you accidentally navigate to another web page, close (and reopen) the browser, and/or hit refresh. Use `Refresh` in the <i title='Power off' class='fa fa-power-off'></i> menu in the navigation bar to return to a clean/new state.
Loading and saving state also works with Rstudio. If you start Radiant from Rstudio and use <i title='Power off' class='fa fa-power-off'></i> > `Stop` to stop the app, lists called `r_data`, `r_info`, and `r_state` will be put into Rstudio's global workspace. If you start radiant again using `radiant::radiant()` it will use these lists to restore state. Also, if you load a state file directly into Rstudio it will be used when you start Radiant to recreate a previous state.
**Technical note**: Loading state works as follows in Radiant: When an input is initialized in a Shiny app you set a default value in the call to, for example, numericInput. In Radiant, when a state file has been loaded and an input is initialized it looks to see if there is a value for an input of that name in a list called `r_state`. If there is, this value is used. The `r_state` list is created when saving state using `reactiveValuesToList(input)`. An example of a call to `numericInput` is given below where the `state_init` function from `radiant.R` is used to check if a value from `r_state` can be used.
```r
numericInput("sm_comp_value", "Comparison value:", state_init("sm_comp_value", 0))
```
## Source code
The source code for the radiant application is available on GitHub at <https://github.com/radiant-rstats>. `radiant.data`, offers tools to load, save, view, visualize, summarize, combine, and transform data. `radiant.design` builds on `radiant.data` and adds tools for experimental design, sampling, and sample size calculation. `radiant.basics` covers the basics of statistical analysis (e.g., comparing means and proportions, cross-tabs, correlation, etc.) and includes a probability calculator. `radiant.model` covers model estimation (e.g., logistic regression and neural networks), model evaluation (e.g., gains chart, profit curve, confusion matrix, etc.), and decision tools (e.g., decision analysis and simulation). Finally, `radiant.multivariate` includes tools to generate brand maps and conduct cluster, factor, and conjoint analysis.
These tools are used in the _Business Analytics_, _Quantitative Analysis_, _Research for Marketing Decisions_, _Applied Market Research_, _Consumer Behavior_, _Experiments in Firms_, _Pricing_, _Pricing Analytics_, and _Customer Analytics_ classes at the Rady School of Management (UCSD).
## Credits
Radiant would not be possible without [R](https://cran.r-project.org/) and [Shiny](https://shiny.posit.co/). I would like to thank [Joe Cheng](https://github.com/jcheng5), [Winston Chang](https://github.com/wch), and [Yihui Xie](https://github.com/yihui) for answering questions, providing suggestions, and creating amazing tools for the R community. Other key components used in Radiant are ggplot2, dplyr, tidyr, magrittr, broom, shinyAce, shinyFiles, rmarkdown, and DT. For an overview of other packages that Radiant relies on please see the <a href="https://radiant-rstats.github.io/docs/about.html" target="_blank">about</a> page.
## License
Radiant is licensed under the <a href="https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)" target="\_blank">AGPLv3</a>. As a summary, the AGPLv3 license requires, attribution, including copyright and license information in copies of the software, stating changes if the code is modified, and disclosure of all source code. Details are in the COPYING file.
The documentation, images, and videos for the `radiant.data` package are licensed under the creative commons attribution and share-alike license <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">CC-BY-SA</a>. All other documentation and videos on this site, as well as the help files for `radiant.design`, `radiant.basics`, `radiant.model`, and `radiant.multivariate`, are licensed under the creative commons attribution, non-commercial, share-alike license <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC-NC-SA</a>.
If you are interested in using any of the radiant packages please email me at radiant@rady.ucsd.edu
&copy; Vincent Nijs (2023) <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank"><img alt="Creative Commons License" style="border-width:0" src="https://radiant-rstats.github.io/docs/images/by-sa.png" /></a>
\ No newline at end of file
setwd(rstudioapi::getActiveProject())
curr <- getwd()
pkg <- basename(curr)
## building radiant packages for mac and windows
# dev <- FALSE
# if (isTRUE(dev)) {
# devprompt <- readline(prompt = paste0("Are you sure you want to build a development version y/n: "))
# if (grepl("[nN]", devprompt)) {
# stop("Set 'dev' to FALSE")
# }
# }
## building package for mac and windows
rv <- R.Version()
rv <- paste(rv$major, substr(rv$minor, 1, 1), sep = ".")
rvprompt <- readline(prompt = paste0("Running for R version: ", rv, ". Is that what you wanted y/n: "))
if (grepl("[nN]", rvprompt)) stop("Change R-version")
dirsrc <- "../minicran/src/contrib"
if (rv < "3.4") {
dirmac <- fs::path("../minicran/bin/macosx/mavericks/contrib", rv)
} else if (rv > "3.6") {
dirmac <- c(
fs::path("../minicran/bin/macosx/big-sur-x86_64/contrib", rv),
fs::path("../minicran/bin/macosx/big-sur-arm64/contrib", rv),
fs::path("../minicran/bin/macosx/contrib", rv)
)
} else {
dirmac <- fs::path("../minicran/bin/macosx/el-capitan/contrib", rv)
}
dirwin <- fs::path("../minicran/bin/windows/contrib", rv)
if (!file.exists(dirsrc)) dir.create(dirsrc, recursive = TRUE)
sapply(dirmac, function(x) if (!file.exists(x)) dir.create(x, recursive = TRUE))
if (!file.exists(dirwin)) dir.create(dirwin, recursive = TRUE)
## delete older version of radiant
rem_old <- function(app) {
unlink(paste0(dirsrc, "/", app, "_*"))
sapply(dirmac, function(x) unlink(paste0(x, "/", app, "_*")))
unlink(paste0(dirwin, "/", app, "_*"))
}
apps <- c(
"radiant.data",
"radiant.design",
"radiant.basics",
"radiant.model",
"radiant.multivariate",
"radiant.update",
"radiant"
)
sapply(apps, rem_old)
dir2set <- file.path(rstudioapi::getActiveProject(), "..")
system(paste0(Sys.which("R"), " -e \"setwd('", dir2set, "'); source('radiant/build/build_mac.R')\""))
win <- readline(prompt = "Did you build on Windows? y/n: ")
if (grepl("[yY]", win)) {
fl <- list.files(pattern = "*.zip", path = "~/Dropbox/r-packages", full.names = TRUE)
for (f in fl) {
file.copy(f, "~/gh/")
}
## move packages to radiant_miniCRAN
## must build packages on Windows first
setwd(file.path(rstudioapi::getActiveProject()))
sapply(list.files("..", pattern = "*.tar.gz", full.names = TRUE), file.copy, dirsrc)
unlink("../*.tar.gz")
unlink("~/Dropbox/r-packages/*.tar.gz")
sapply(list.files("..", pattern = "*.tgz", full.names = TRUE), file.copy, dirmac[1])
sapply(list.files("..", pattern = "*.tgz", full.names = TRUE), file.copy, dirmac[2])
unlink("../*.tgz")
sapply(list.files("..", pattern = "*.zip", full.names = TRUE), file.copy, dirwin)
unlink("../*.zip")
unlink("~/Dropbox/r-packages/*.zip") # cleanup
for (d in dirmac) {
tools::write_PACKAGES(d, type = "mac.binary")
}
tools::write_PACKAGES(dirwin, type = "win.binary")
tools::write_PACKAGES(dirsrc, type = "source")
# commit to repo
setwd(file.path(rstudioapi::getActiveProject(), "../minicran"))
system("git add --all .")
mess <- paste0("radiant package updates: ", format(Sys.Date(), format = "%m-%d-%Y"))
system(paste0("git commit -m '", mess, "'"))
system("git push")
setwd(rstudioapi::getActiveProject())
}
# testing
# remove.packages(c("radiant.data", "radiant.model", "radiant", "radiant.multivariate", "radiant.basics", "radiant.design", "dplyr"))
# options(repos=c(RSM = "https://radiant-rstats.github.io/minicran"))
# install.packages("radiant.update")
# install.packages("radiant.update", type = "binary")
# radiant.update::radiant.update()
## Update applications
curr <- getwd()
update_app <- function(app, mess = "Update [ci skip]", git = FALSE, github = FALSE) {
cat("========================================\n")
cat("Working on app:", app)
cat("\n========================================\n")
setwd(file.path(curr, app))
devtools::document(roclets = c("rd", "collate", "namespace"))
devtools::install(dependencies = FALSE)
if (git) {
system("git add --all .")
system(paste0("git commit -m '", mess, "'"))
}
if (github) system("git push")
invisible()
}
apps <- c(
"radiant.data",
"radiant.design",
"radiant.basics",
"radiant.model",
"radiant.multivariate",
"radiant.update",
"radiant"
)
sapply(apps, update_app, mess = "CRAN", git = TRUE, github = TRUE)
## build for packages ahead of CRAN
# apps <- c("shinyAce", "rstudioapi", apps)
## build for mac
setwd(curr)
build_app <- function(app) {
f <- devtools::build(file.path(curr, app))
system(paste0("R CMD INSTALL --build ", f))
}
sapply(apps, build_app)
setwd(curr)
## build for windows
rv <- R.Version()
rv <- paste0(rv$major, ".", strsplit(rv$minor, ".", fixed = TRUE)[[1]][1])
rvprompt <- readline(prompt = paste0("Running for R version: ", rv, ". Is that what you wanted y/n: "))
if (grepl("[nN]", rvprompt)) {
stop("Change R-version using Rstudio > Tools > Global Options > Rversion")
}
apps <- c(
"radiant.data",
"radiant.design",
"radiant.basics",
"radiant.model",
"radiant.multivariate",
"radiant.update",
"radiant"
)
sapply(apps, function(x) devtools::install(pkg = paste0("../", x), upgrade = "never"))
path <- normalizePath(file.path(rstudioapi::getActiveProject(), ".."), winslash = "/")
curr <- setwd(path)
build_app <- function(app) {
f <- devtools::build(file.path(".", app), binary = TRUE)
}
sapply(apps, build_app)
setwd(curr)
fl <- list.files(pattern = "*.zip", path = "../", full.names = TRUE)
for (f in fl) {
print(glue::glue("Copying: {f}"))
file.copy(f, "C:/Users/vnijs/Dropbox/r-packages/", overwrite = TRUE)
unlink(f)
}
## testing
remove.packages(c("radiant.data", "radiant.model", "radiant", "radiant.basics", "radiant.design", "radiant.multivariate"))
options(repos = c(RSM = "https://radiant-rstats.github.io/minicran"))
install.packages("radiant.update")
# install.packages("radiant.data", type = "binary")
radiant.update::radiant.update()
## Resubmission
This is a resubmission. See NEWS.md for changes.
## Test environments
* macOS, R 4.3.2
* macOS, R 4.4.0
* win-builder (devel)
## R CMD check results
There were no ERRORs or WARNINGs. There was one NOTE related to the number of non-standard dependencies. However, this note is not easily addressed without substantially inconveniencing users that rely on the web (shiny) interface available for radiant.data.
# Previous cran-comments
## Resubmission
This is a resubmission. See NEWS.md for changes.
## Test environments
* macOS, R 4.3.2
* win-builder (devel)
## Resubmission
This is a resubmission. See NEWS.md for changes.
## Test environments
* macOS, R 4.3.1
* win-builder (devel)
## R CMD check results
There were no ERRORs or WARNINGs. There was one NOTE related to the number of non-standard dependencies. However, this note is not easily addressed without substantially inconveniencing users that rely on the web (shiny) interface available for radiant.data.
## Resubmission
This is a resubmission. See NEWS.md for changes.
## Test environments
* macOS, R 4.2.2
* win-builder (devel)
## R CMD check results
There were no ERRORs or WARNINGs. There was one NOTE related to the number of non-standard dependencies. However, this note is not easily addressed without substantially inconveniencing users that rely on the web (shiny) interface available for radiant.data.
## Resubmission
This is a resubmission. See NEWS.md for changes.
## Test environments
* macOS, R 4.2.1
* win-builder (devel)
## R CMD check results
There were no ERRORs or WARNINGs. There was one NOTE related to the number of non-standard dependencies. However, this note is not easily addressed without substantially inconveniencing users that rely on the web (shiny) interface available for radiant.data.
## Resubmission
This is a resubmission. In this version I have fixed bugs and updated documentation (see NEWS.md for details).
## Test environments
* macOS, R 4.2.0
* win-builder (devel)
## R CMD check results
There were no ERRORs, WARNINGs, or NOTEs.
## Resubmission
This is a resubmission. In this version I have fixed an important bug (see NEWS.md for details). It seems the previous issues getting the Vignette to build on Windows are due to an issue in Rmarkdown. I tested a work around proposed by Christophe Dervieux (see https://github.com/rstudio/rmarkdown/issues/2163) and it seems to work with the win-builder test environment. A new version of Rmarkdown that addresses the issue should also be submitted to CRAN in the near future.
## Test environments
* Ubuntu 20.04 through WSL2, R 4.0.5
* Ubuntu 20.04, R 4.1.0
* win-builder (devel)
## R CMD check results
There were no ERRORs or NOTEs. However, there was one WARNING (see below). I cannot reproduce the `InvalidUrlException` mentioned however. The URL is already absolute and works as intended locally.
I posted a message to the R-development mailing list and received the suggestion to ask CRAN to run the tests again.
Is it possible this is a windows build issue? Based on the below, it seems the InvalidUrlException only affects windows checks. These problems were not present when radiant version 1.3.2 was submitted, else it wouldn't have gotten on CRAN in the first place.
https://cran.r-project.org/web/checks/check_results_radiant.html
Hopefully you can provide some guidance if needed.
<https:/cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css>
```
* checking re-building of vignette outputs ... [24s] WARNING
Error(s) in re-building vignettes:
--- re-building 'programming.Rmd' using rmarkdown
pandoc.exe: Could not fetch https:/cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css
InvalidUrlException "https:/cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" "URL must be absolute"
```
## Resubmission
This is a resubmission. In this version I have fixed several bugs and added several new features (see NEWS.md for details).
## Test environments
* local OS X install, R 3.6.3
* ubuntu "trusty" (on travis-ci), R release and devel
* win-builder (devel)
## R CMD check results
There were no ERRORs, WARNINGs, or NOTEs.
# Previous cran-comments
## Resubmission
This is a resubmission. In this version I have updated dependencies to address an issue with building a vignette brought to my attention by an email from Prof Ripley (see email below). I believe the problem is related an issue in radiant.multivariate after recent changes to dplyr (0.8.1).
radiant now requires radiant.multivariate >= 0.9.9.1 and should build the vignette correctly without excissive memory consumption
## Test environments
* local OS X install, R 3.6.0
* local Windows install, R 3.6.0
* ubuntu "trusty" (on travis-ci), R release and devel
* win-builder
## R CMD check results
There were no ERRORs, WARNINGs, or NOTEs.
Date: Wed, May 15, 2019 at 12:43 AM
Subject: CRAN package radiant
To: Vincent Nijs <radiant@rady.ucsd.edu>
Cc: CRAN <CRAN@r-project.org>
See https://cran.r-project.org/web/checks/check_results_radiant.html .
This is using a ridiculous amount of RAM for its vignettes: on a larger
machine I saw a peak allocation of 313Gb, 260 of which was in memory.
Please correct ASAP (using a maximum of 5GB) and before May 22 to safely
retain the package on CRAN. Meanwhile we will exclude checking the
vignettes.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
# Previous cran-comments
## Resubmission
This is a resubmission. In this version I have fixed several bugs and added several new features (see NEWS.md for details).
## Test environments
* local OS X install, R 3.5.2
* local Windows install, R 3.5.2
* ubuntu "trusty" (on travis-ci), R release and devel
* win-builder
## R CMD check results
There were no ERRORs, WARNINGs, or NOTEs.
## Resubmission
radiant was recently archived and removed from CRAN. Uwe Ligges confirmed that multiple emails were sent to my radiant@rady.ucsd.edu email address but, unfortunately, I cannot find any such emails in my inbox. I hope you will accept radiant as a resubmission.
## Test environments
* local OS X install, R 3.5.1
* local Windows install, R 3.5.1
* Ubuntu "trusty" (on travis-ci), R oldrel, release, and devel
* win-builder
## R CMD check results
There were no ERRORs, WARNINGs, or NOTEs.
## Resubmission
This is a resubmission. In this version I have fixed several bugs and added several new features (see NEWS.md for details).
radiant depends on all radiant.* packages. From the last time I submitted updates to CRAN I seem to recall Uwe Ligges suggested I submit all radiant packages to be updated at the same time. I hope my recollection is correct and that this is indeed the preferred approach that will minimize workload for CRAN.
## Test environments
* local OS X install, R 3.5.0
* local Windows install, R 3.5.0
* ubuntu "trusty" (on travis-ci), R release and devel
* win-builder
## R CMD check results
There were no ERRORs, WARNINGs, or NOTEs.
## Previous cran-comments
## Resubmission
This is a resubmission (0.8.0). In this version I have updated all dependencies to the `radiant.*` packages and fixed notes shown at https://cran.rstudio.com/web/checks/check_results_radiant.html.
Please note that this version addresses the reverse dependency check warnings from radiant.data for the `radiant.*` packages. Deprecating the `*_each` commands used in the 0.6.0 versions of the `radiant.*` packages is related to the deprecation of the `*_each` functions in dplyr.
## Test environments
* local OS X install, R 3.4
* local Windows install, R 3.4
* ubuntu 14.04 (on travis-ci), R 3.3.3 and R-dev
* win-builder (release)
## R CMD check results
There were no ERRORs or WARNINGs. There was one NOTE about possibly mis-spelled words ("Analytics" and "analytics"). The spelling is correct however.
## Resubmission
This is a resubmission. In this version I have tried to make all requested changes as follows:
"You still refer to multiple help pages on Github, e.g. https://radiant-rstats.github.io/docs/radiant.multivariate.pdf."
* There are no more links to GitHub in the vignette
"You refer to local files (at least "/docs/data/code.html") that will not exist on your users' systems."
* There are no references to files that are not on the user's system in the vignette
"You still have no examples in your help pages."
* I have added examples to the help pages. Please note, however, that they are set to 'dontrun' because the functions exported in the radiant package should not be run as a part of automated testing.
I apologize if I missed something or did not provided the expected changes. I'm happy to fix or change whatever is required.
## Previous cran-comments
## Resubmission
This is a resubmission. In this version I have:
* Fixed the links in the vignette. Thanks!
* Radiant is a shiny app and all help associated with its sub-packages (e.g., radiant.data) is available when your run the app (see inst/app/tools/help in 'radiant.data' for its source markdown files). Having access to these help files through the user interface is more convenient than through R or Rstudio help because you also see it directly in the browser. See https://youtu.be/9qAQio9Hb7k?t=53 for an illustration. Note that users have access to these help files even if they are offline (i.e., they are part of the radiant packages).
* I still have links to the _Report_ and _Code_ page on github in the vignette. These are not function manuals but illustrate how to use the shiny user interface.
* For reference, maybe it is useful to mention that the structure of the radiant package is somewhat similar to the recently released 'tidyverse' package that pools functionality across several packages
* I now show `help(package = radiant.data)` rather than the github links to the manuals. I hope that is what you were looking for
* There are no examples because the package is an rstudio addin and a shiny app. The UI code is in inst/app and must be tested interactively. The code in R/ is for running and updating the application and is only used in interactive sessions. In sum, testing, including examples, must be done by the package maintainer and the end-user. The analysis code used as part of the different Radiant menu's is in the packages radiant.data, radiant.design, radiant.basics, radiant.model, and radiant.multivariate that I recently submitted to CRAN and is tested there.
## Previous cran-comments
## Resubmission
This is a resubmission. In this version I have:
* added a vignette to document the package
## Previous cran-comments
## Resubmission
* I was already using R 3.3.1 for the previous submissions and (re-)building and knitting the vignette worked fine. I did various searches online and, as far as I can tell, I followed the appropriate devtools process. The message continued to show up however. I asked for additional guidance but didn't receive any and so I decided to remove the vignette to avoid wasting more CRAN time. Also, the text that was in the vignette is also available on the Radiant documentation site at the following link: https://radiant-rstats.github.io/docs/programming.html
* Radiant is an rstudio addin and a shiny app. The UI code is in inst/app and must be tested interactively. The code in R/ is for running and updating the application and is only used in interactive sessions. In sum, testing, including examples, must be done by the package maintainer and the end-user. The analysis code used as part of the different Radiant menu's is in the packages radiant.data, radiant.design, radiant.basics, radiant.model, and radiant.multivariate that I recently submitted to CRAN and is tested there.
## Resubmission
This is a resubmission. In this version I have:
* removed the vignette to eliminate the "Package has a VignetteBuilder field but no prebuilt vignette index" note
* added tests to avoid "checking for code which exercises the package ... WARNING No examples, no tests, no vignettes" warning
## Previous cran-comments
This is a resubmission. In this version I have:
* Removed the offending URL.
* Used single quotes for R package names in the Description
* I did various searches online and, as far as I can tell, I am following the appropriate devtools process (FYI I'm using devtools 1.12.0) and (re-)building and knitting the vignette during the build process works fine. Could you perhaps provide additional guidance about how one might even fix "Package has a VignetteBuilder field but no prebuilt vignette index."? Should the submission contain an INDEX file? If so, could you point to an example? Would it be appropriate to make a pdf of the vignette and submit that?
* If no additional guidance is available I will remove the vignette as the same document is available at the following link:
https://radiant-rstats.github.io/docs/programming.html. However, that will lead to the warning "checking for code which exercises the package ... WARNING No examples, no tests, no vignettes". As previously stated "Radiant is an rstudio addin and a shiny app. The UI code is in inst/app and must be tested interactively. The code in R/ is for running and updating the application and is only used in interactive sessions. In sum, testing must be done by the package maintainer and the end-user. The analysis code used as part of Radiant is in the packages radiant.data, radiant.design, radiant.basics, radiant.model, and radiant.multivariate that I recently submitted to CRAN and is tested there." Please advice. Thanks.
## Resubmission
This is a resubmission. In this version I have:
* I was already using R 3.3.1 for the previous submission and (re-)building and knitting the vignette works fine. I did various searches online and, as far as I can tell, I am following the appropriate devtools process. If the message still shows up I must not fully understand the pre-built index issue. FYI I'm using devtools 1.12.0.
* Changed the Description field so it does not start with the package name
* Radiant is an rstudio addin and a shiny app. The UI code is in inst/app and must be tested interactively. The code in R/ is for running and updating the application and is only used in interactive sessions. In sum, testing must be done by the package maintainer and the end-user. The analysis code used as part of Radiant is in the packages radiant.data, radiant.design, radiant.basics, radiant.model, and radiant.multivariate that I recently submitted to CRAN and is tested there.
## Test environments
* local OS X install, R 3.3.1
* local Windows install, R 3.3.1
* ubuntu 12.04 (on travis-ci), R 3.3.1
* win-builder (devel and release)
## R CMD check results
There were no ERRORs.
There was 1 NOTE: New submission. This package was archived.
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page not found (404) • radiant</title>
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="bootstrap-toc.css">
<script src="bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="pkgdown.css" rel="stylesheet">
<script src="pkgdown.js"></script><meta property="og:title" content="Page not found (404)">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#toc">
<div class="container template-title-body">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="articles/programming.html">Programming with Radiant</a>
</li>
</ul>
</li>
<li>
<a href="news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container -->
</div>
<!--/.navbar -->
</header><div class="row">
<div class="contents col-md-9">
<div class="page-header">
<h1>Page not found (404)</h1>
</div>
Content not found. Please use links in the navbar.
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav>
</div>
</div>
<footer><div class="copyright">
<p></p>
<p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer>
</div>
</body>
</html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>License • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="bootstrap-toc.css"><script src="bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="pkgdown.css" rel="stylesheet"><script src="pkgdown.js"></script><meta property="og:title" content="License"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-title-body">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="contents col-md-9">
<div class="page-header">
<h1>License</h1>
</div>
<pre>Radiant is licensed under AGPL3 (see https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0) and https://www.r-project.org/Licenses/AGPL-3). The radiant help files are licensed under the creative commons attribution, non-commercial, share-alike license CC-NC-SA (https://creativecommons.org/licenses/by-nc-sa/4.0/).
As a summary, the AGPLv3 license requires, attribution, including copyright and license information in copies of the software, stating changes if the code is modified, and disclosure of all source code. Details are in the COPYING file.
If you are interested in using Radiant please email me at radiant@rady.ucsd.edu
ALL HELPFILES IN THE RADIANT APPLICATION USE THE FOLLOWING LICENSE (https://creativecommons.org/licenses/by-nc-sa/4.0/)
========================================================================================================================
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 – Definitions.
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 – Scope.
License grant.
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
Term. The term of this Public License is specified in Section 6(a).
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
Downstream recipients.
Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
Other rights.
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
Patent and trademark rights are not licensed under this Public License.
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
Section 3 – License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
Attribution.
If You Share the Licensed Material (including in modified form), You must:
retain the following if it is supplied by the Licensor with the Licensed Material:
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
a copyright notice;
a notice that refers to this Public License;
a notice that refers to the disclaimer of warranties;
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
ShareAlike.
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
Section 4 – Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 – Disclaimer of Warranties and Limitation of Liability.
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 – Term and Termination.
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 – Other Terms and Conditions.
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 – Interpretation.
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
</pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Articles • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Articles"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-article-index">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Articles</h1>
</div>
<div class="section ">
<h3>All vignettes</h3>
<p class="section-desc"></p>
<dl><dt><a href="programming.html">Programming with Radiant</a></dt>
<dd>
</dd></dl></div>
</div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Programming with Radiant • radiant</title>
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><meta property="og:title" content="Programming with Radiant">
<meta property="og:description" content="radiant">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#toc">
<div class="container template-article">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul>
</li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container -->
</div>
<!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
<h1 data-toc-skip>Programming with Radiant</h1>
<h4 data-toc-skip class="author">Vincent R.
Nijs, Rady School of Management (UCSD)</h4>
<h4 data-toc-skip class="date">2023-09-05</h4>
<small class="dont-index">Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/vignettes/programming.Rmd" class="external-link"><code>vignettes/programming.Rmd</code></a></small>
<div class="hidden name"><code>programming.Rmd</code></div>
</div>
<p>Radiant’s goal is to provide access to the power of R for business
analytics and data science. Although Radiant’s web-interface can handle
many data and analysis tasks, you may prefer to write your own code.
Radiant provides a bridge to programming in R(studio) by exporting the
functions used for analysis. For example, you can run your analyses in
Radiant and output the relevant function calls to an R or <a href="https://rmarkdown.rstudio.com/" class="external-link">Rmarkdown</a> document. Most pages
in the app have an <i title="Report results" class="fa fa-edit"></i>
icon on the bottom left of your screen that you can click to generate a
(reproducible) report with your analysis in the <em>Report &gt; Rmd</em>
(or <em>Report &gt; R</em>) tab. As an alternative to clicking the
<i title="Report results" class="fa fa-edit"></i> icon you can also
press <code>ALT-enter</code> on your keyboard. Click the
<code>Knit report</code> button on the <em>Report &gt; Rmd</em> page to
render the report to HTML or press the <code>Save report</code> button
to produce a Notebook, HTML, PDF, Word, or Rmarkdown file. Radiant’s
function manuals can be viewed using the commands below:</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/help.html" class="external-link">help</a></span><span class="op">(</span>package <span class="op">=</span> <span class="va">radiant.data</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/help.html" class="external-link">help</a></span><span class="op">(</span>package <span class="op">=</span> <span class="va">radiant.design</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/help.html" class="external-link">help</a></span><span class="op">(</span>package <span class="op">=</span> <span class="va">radiant.basics</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/help.html" class="external-link">help</a></span><span class="op">(</span>package <span class="op">=</span> <span class="va">radiant.model</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/help.html" class="external-link">help</a></span><span class="op">(</span>package <span class="op">=</span> <span class="va">radiant.multivariate</span><span class="op">)</span></span></code></pre></div>
<p>You can also use Rstudio to render and edit Rmarkdown documents
generated in Radiant. When you install and load Radiant it exports
functions that can be called from R-code and/or an Rmarkdown document.
For example, you can paste the commands below into the command console
to get the same output as in the browser interface.</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/radiant-rstats/radiant" class="external-link">radiant</a></span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/data.html" class="external-link">data</a></span><span class="op">(</span><span class="va">diamonds</span>, envir <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/environment.html" class="external-link">environment</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="va">result</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://radiant-rstats.github.io/radiant.basics/reference/single_mean.html" class="external-link">single_mean</a></span><span class="op">(</span><span class="va">diamonds</span>, <span class="st">"price"</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">result</span><span class="op">)</span></span></code></pre></div>
<pre><code>Single mean test
Data : diamonds
Variable : price
Confidence: 0.95
Null hyp. : the mean of price = 0
Alt. hyp. : the mean of price is not equal to 0
mean n n_missing sd se me
3,907.186 3,000 0 3,956.915 72.243 141.651
diff se t.value p.value df 2.5% 97.5%
3907.186 72.243 54.084 &lt; .001 2999 3765.535 4048.837 ***
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">result</span><span class="op">)</span></span></code></pre></div>
<p><img src="programming_files/figure-html/single_mean_price-1.png" width="480"></p>
<p>You can also call functions for visualization (see below) and access
help from the console using <code><a href="https://radiant-rstats.github.io/radiant.data/reference/visualize.html" class="external-link">?visualize</a></code></p>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://radiant-rstats.github.io/radiant.data/reference/visualize.html" class="external-link">visualize</a></span><span class="op">(</span></span>
<span> <span class="va">diamonds</span>, </span>
<span> xvar <span class="op">=</span> <span class="st">"carat"</span>, </span>
<span> yvar <span class="op">=</span> <span class="st">"price"</span>, </span>
<span> type <span class="op">=</span> <span class="st">"scatter"</span>,</span>
<span> facet_row <span class="op">=</span> <span class="st">"clarity"</span>, </span>
<span> color <span class="op">=</span> <span class="st">"clarity"</span>, </span>
<span> labs <span class="op">=</span> <span class="fu">labs</span><span class="op">(</span>title <span class="op">=</span> <span class="st">"Diamond Prices ($)"</span><span class="op">)</span>,</span>
<span> custom <span class="op">=</span> <span class="cn">FALSE</span></span>
<span><span class="op">)</span> </span></code></pre></div>
<p><img src="programming_files/figure-html/scatter-1.png" width="480"></p>
<p>Use <code><a href="https://github.com/radiant-rstats/radiant" class="external-link">library(radiant)</a></code> to load the library. To see the
index of functions currently available in, for example, Radiant’s Model
menu use the <code><a href="https://radiant-rstats.github.io/radiant.model/reference" class="external-link">help(package = "radiant.model")</a></code> command</p>
<p>Lets start by comparing the mean of a variable to a (population)
value using R’s built-in <code>mtcars</code> dataset. This functionality
is in the Radiant menu <em>Basics &gt; Means &gt; Single mean</em>. The
analysis is conducted in function <code>single_mean</code>. Calling the
<code>summary</code> method on the result object will show tabular
output. Calling <code>plot</code> on the same result object will produce
relevant plots.</p>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">result</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://radiant-rstats.github.io/radiant.basics/reference/single_mean.html" class="external-link">single_mean</a></span><span class="op">(</span></span>
<span> <span class="va">mtcars</span>, </span>
<span> var <span class="op">=</span> <span class="st">"mpg"</span>, </span>
<span> comp_value <span class="op">=</span> <span class="fl">20</span>, </span>
<span> alternative <span class="op">=</span> <span class="st">"greater"</span></span>
<span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">result</span><span class="op">)</span></span></code></pre></div>
<pre><code>Single mean test
Data : mtcars
Variable : mpg
Confidence: 0.95
Null hyp. : the mean of mpg = 20
Alt. hyp. : the mean of mpg is &gt; 20
mean n n_missing sd se me
20.091 32 0 6.027 1.065 2.173
diff se t.value p.value df 5% 100%
0.091 1.065 0.085 0.466 31 18.284 Inf
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">result</span>, plots <span class="op">=</span> <span class="st">"hist"</span><span class="op">)</span></span></code></pre></div>
<p><img src="programming_files/figure-html/single_mean_mpg-1.png" width="480"></p>
<p>To compare the mean price of diamonds across different levels of
clarity we can call the <code>compare_means</code> function:</p>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">result</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://radiant-rstats.github.io/radiant.basics/reference/compare_means.html" class="external-link">compare_means</a></span><span class="op">(</span></span>
<span> <span class="va">diamonds</span>, </span>
<span> var1 <span class="op">=</span> <span class="st">"clarity"</span>, </span>
<span> var2 <span class="op">=</span> <span class="st">"price"</span>, </span>
<span> adjust <span class="op">=</span> <span class="st">"bonf"</span></span>
<span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">result</span><span class="op">)</span></span></code></pre></div>
<pre><code>Pairwise mean comparisons (t-test)
Data : diamonds
Variables : clarity, price
Samples : independent
Confidence: 0.95
Adjustment: Bonferroni
clarity mean n n_missing sd se me
I1 4,194.775 40 0 2,519.678 398.396 805.832
SI2 5,100.189 529 0 4,406.982 191.608 376.407
SI1 3,998.577 721 0 3,813.190 142.011 278.804
VS2 3,822.967 661 0 3,917.484 152.372 299.193
VS1 3,789.181 442 0 3,880.907 184.596 362.797
VVS2 3,337.820 284 0 3,932.706 233.363 459.348
VVS1 2,608.460 224 0 3,201.282 213.895 421.513
IF 2,411.697 99 0 3,330.560 334.734 664.268
Null hyp. Alt. hyp. diff p.value
I1 = SI2 I1 not equal to SI2 -905.414 1
I1 = SI1 I1 not equal to SI1 196.198 1
I1 = VS2 I1 not equal to VS2 371.808 1
I1 = VS1 I1 not equal to VS1 405.594 1
I1 = VVS2 I1 not equal to VVS2 856.955 1
I1 = VVS1 I1 not equal to VVS1 1586.315 0.023 *
I1 = IF I1 not equal to IF 1783.078 0.025 *
SI2 = SI1 SI2 not equal to SI1 1101.612 &lt; .001 ***
SI2 = VS2 SI2 not equal to VS2 1277.222 &lt; .001 ***
SI2 = VS1 SI2 not equal to VS1 1311.008 &lt; .001 ***
SI2 = VVS2 SI2 not equal to VVS2 1762.369 &lt; .001 ***
SI2 = VVS1 SI2 not equal to VVS1 2491.729 &lt; .001 ***
SI2 = IF SI2 not equal to IF 2688.492 &lt; .001 ***
SI1 = VS2 SI1 not equal to VS2 175.610 1
SI1 = VS1 SI1 not equal to VS1 209.396 1
SI1 = VVS2 SI1 not equal to VVS2 660.757 0.446
SI1 = VVS1 SI1 not equal to VVS1 1390.117 &lt; .001 ***
SI1 = IF SI1 not equal to IF 1586.880 0.001 ***
VS2 = VS1 VS2 not equal to VS1 33.786 1
VS2 = VVS2 VS2 not equal to VVS2 485.146 1
VS2 = VVS1 VS2 not equal to VVS1 1214.507 &lt; .001 ***
VS2 = IF VS2 not equal to IF 1411.270 0.005 **
VS1 = VVS2 VS1 not equal to VVS2 451.361 1
VS1 = VVS1 VS1 not equal to VVS1 1180.721 0.001 ***
VS1 = IF VS1 not equal to IF 1377.484 0.012 *
VVS2 = VVS1 VVS2 not equal to VVS1 729.361 0.606
VVS2 = IF VVS2 not equal to IF 926.123 0.68
VVS1 = IF VVS1 not equal to IF 196.763 1
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">result</span>, plots <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"bar"</span>, <span class="st">"density"</span><span class="op">)</span><span class="op">)</span></span></code></pre></div>
<p><img src="programming_files/figure-html/compare_means_diamonds-1.png" width="384"></p>
<p>These datasets are available after loading the radiant library by
using the <code>data</code> function. We can also load data through
Radiant’s browser interface and then access the data from the console
after closing the app. Start radiant using the command below and then
click select <code>Examples</code> from the
<code>Load data of type</code> dropdown in the <em>Data &gt; Manage</em>
tab. Then close the app by clicking the
<i title="Power off" class="fa fa-power-off"></i> icon in the navbar and
then clicking <code>Stop</code>. The datasets loaded through the
web-interface are now available in the <code>r_data</code> environment
as well. To use them directly in your code use
<code>attach(r_data)</code>.</p>
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co">## start radiant in Rstudio, load the example data, then click the power </span></span>
<span><span class="co">## icon in the navigation bar and click on Stop</span></span>
<span><span class="fu">radiant</span><span class="fu">::</span><span class="fu"><a href="../reference/radiant.html">radiant</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p>Because we already loaded the radiant library we already have access
to all the data we need here. Lets use the <code>compare_means</code>
function to evaluate salary data for professors of different ranks
using:</p>
<div class="sourceCode" id="cb13"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">result</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://radiant-rstats.github.io/radiant.basics/reference/compare_means.html" class="external-link">compare_means</a></span><span class="op">(</span><span class="va">salary</span>, var1 <span class="op">=</span> <span class="st">"rank"</span>, var2 <span class="op">=</span> <span class="st">"salary"</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">result</span><span class="op">)</span></span></code></pre></div>
<pre><code>Pairwise mean comparisons (t-test)
Data : salary
Variables : rank, salary
Samples : independent
Confidence: 0.95
Adjustment: None
rank mean n n_missing sd se me
AsstProf 80,775.985 67 0 8,174.113 998.627 1,993.823
AssocProf 93,876.438 64 0 13,831.700 1,728.962 3,455.056
Prof 126,772.109 266 0 27,718.675 1,699.541 3,346.322
Null hyp. Alt. hyp. diff p.value
AsstProf = AssocProf AsstProf not equal to AssocProf -13100.45 &lt; .001 ***
AsstProf = Prof AsstProf not equal to Prof -45996.12 &lt; .001 ***
AssocProf = Prof AssocProf not equal to Prof -32895.67 &lt; .001 ***
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">result</span><span class="op">)</span></span></code></pre></div>
<p><img src="programming_files/figure-html/compare_means_salary-1.png" width="384"></p>
<p>We can also run regressions and get output in a format that would
require quite a few lines of code to produce from scratch:</p>
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">result</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://radiant-rstats.github.io/radiant.model/reference/regress.html" class="external-link">regress</a></span><span class="op">(</span><span class="va">diamonds</span>, rvar <span class="op">=</span> <span class="st">"price"</span>, evar <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"carat"</span>,<span class="st">"clarity"</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">result</span>, sum_check <span class="op">=</span> <span class="st">"confint"</span><span class="op">)</span></span></code></pre></div>
<pre><code>Linear regression (OLS)
Data : diamonds
Response variable : price
Explanatory variables: carat, clarity
Null hyp.: the effect of x on price is zero
Alt. hyp.: the effect of x on price is not zero
coefficient std.error t.value p.value
(Intercept) -6780.993 204.952 -33.086 &lt; .001 ***
carat 8438.030 51.101 165.125 &lt; .001 ***
clarity|SI2 2790.760 201.395 13.857 &lt; .001 ***
clarity|SI1 3608.531 200.508 17.997 &lt; .001 ***
clarity|VS2 4249.906 201.607 21.080 &lt; .001 ***
clarity|VS1 4461.956 204.592 21.809 &lt; .001 ***
clarity|VVS2 5109.476 210.207 24.307 &lt; .001 ***
clarity|VVS1 5027.669 214.251 23.466 &lt; .001 ***
clarity|IF 5265.170 233.658 22.534 &lt; .001 ***
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
R-squared: 0.904, Adjusted R-squared: 0.904
F-statistic: 3530.024 df(8,2991), p.value &lt; .001
Nr obs: 3,000
coefficient 2.5% 97.5% +/-
(Intercept) -6780.993 -7182.855 -6379.131 401.862
carat 8438.030 8337.834 8538.227 100.196
clarity|SI2 2790.760 2395.873 3185.646 394.886
clarity|SI1 3608.531 3215.384 4001.679 393.148
clarity|VS2 4249.906 3854.604 4645.208 395.302
clarity|VS1 4461.956 4060.801 4863.111 401.155
clarity|VVS2 5109.476 4697.311 5521.640 412.165
clarity|VVS1 5027.669 4607.574 5447.764 420.095
clarity|IF 5265.170 4807.024 5723.317 458.147</code></pre>
<div class="sourceCode" id="cb18"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">pred</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/predict.html" class="external-link">predict</a></span><span class="op">(</span><span class="va">result</span>, pred_cmd <span class="op">=</span> <span class="st">"carat = 1:10"</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/print.html" class="external-link">print</a></span><span class="op">(</span><span class="va">pred</span>, n <span class="op">=</span> <span class="fl">10</span><span class="op">)</span></span></code></pre></div>
<pre><code>Linear regression (OLS)
Data : diamonds
Response variable : price
Explanatory variables: carat, clarity
Interval : confidence
Prediction command : carat = 1:10
clarity carat Prediction 2.5% 97.5% +/-
SI1 1 5265.569 5174.776 5356.362 90.793
SI1 2 13703.599 13557.662 13849.536 145.937
SI1 3 22141.629 21908.326 22374.933 233.303
SI1 4 30579.660 30251.571 30907.748 328.088
SI1 5 39017.690 38592.329 39443.051 425.361
SI1 6 47455.720 46931.983 47979.458 523.738
SI1 7 55893.751 55271.056 56516.445 622.695
SI1 8 64331.781 63609.787 65053.775 721.994
SI1 9 72769.811 71948.301 73591.322 821.511
SI1 10 81207.842 80286.667 82129.017 921.175</code></pre>
<div class="sourceCode" id="cb20"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">result</span>, plots <span class="op">=</span> <span class="st">"coef"</span><span class="op">)</span></span></code></pre></div>
<p><img src="programming_files/figure-html/regress_coeff-1.png" width="576"></p>
<div class="sourceCode" id="cb21"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">result</span>, plots <span class="op">=</span> <span class="st">"dashboard"</span>, lines <span class="op">=</span> <span class="st">"line"</span>, nrobs <span class="op">=</span> <span class="fl">100</span><span class="op">)</span></span></code></pre></div>
<p><img src="programming_files/figure-html/regress_dashboard-1.png" width="480"></p>
<p>As another example, imagine that you want to segment a sample of
respondents based on their toothpaste attitudes. Below is the required
code to produce results using functions from the Radiant package. For
help on the commands and options for cluster analysis use
<code><a href="https://radiant-rstats.github.io/radiant.multivariate/reference/hclus.html" class="external-link">?hclus</a></code>, <code><a href="https://radiant-rstats.github.io/radiant.multivariate/reference/plot.hclus.html" class="external-link">?plot.hclus</a></code>, and <code>?klus</code>.
See also the Radiant function manuals linked above.</p>
<div class="sourceCode" id="cb22"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co">## run hierarchical cluster analysis on the shopping data, variables v1 through v6</span></span>
<span><span class="va">result</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://radiant-rstats.github.io/radiant.multivariate/reference/hclus.html" class="external-link">hclus</a></span><span class="op">(</span><span class="va">shopping</span>, <span class="st">"v1:v6"</span><span class="op">)</span></span>
<span></span>
<span><span class="co">## summary - not much here - plots are more important</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">result</span><span class="op">)</span></span></code></pre></div>
<pre><code>Hierarchical cluster analysis
Data : shopping
Variables : v1, v2, v3, v4, v5, v6
Method : ward.D
Distance : sq.euclidian
Standardize : TRUE
Observations: 20 </code></pre>
<div class="sourceCode" id="cb24"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co">## check the help file on how to plot results from hierarchical cluster</span></span>
<span><span class="co">## analysis default plots</span></span>
<span><span class="co">## it looks like there is a big jump in overall within-cluster</span></span>
<span><span class="co">## heterogeneity in the step from 3 to 2 segments</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">result</span><span class="op">)</span></span></code></pre></div>
<p><img src="programming_files/figure-html/hclus-1.png" width="384"></p>
<div class="sourceCode" id="cb25"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co">## show the dendrogram with cutoff at 0.05</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">result</span>, plots <span class="op">=</span> <span class="st">"dendro"</span>, cutoff <span class="op">=</span> <span class="fl">0.05</span><span class="op">)</span></span></code></pre></div>
<p><img src="programming_files/figure-html/dendro-1.png" width="384"></p>
<div class="sourceCode" id="cb26"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co">## plots created above suggest 3 clusters may be most appropriate</span></span>
<span><span class="co">## use kclus to create the clusters</span></span>
<span><span class="co">## generate output and store cluster membership</span></span>
<span><span class="va">result</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://radiant-rstats.github.io/radiant.multivariate/reference/kclus.html" class="external-link">kclus</a></span><span class="op">(</span><span class="va">shopping</span>, vars <span class="op">=</span> <span class="st">"v1:v6"</span>, nr_clus <span class="op">=</span> <span class="fl">3</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">result</span><span class="op">)</span></span></code></pre></div>
<pre><code>K-means cluster analysis
Data : shopping
Variables : v1, v2, v3, v4, v5, v6
Clustering by: K-means
HC method : ward.D
HC distance : sq.euclidian
Standardize : TRUE
Observations : 20
Generated : 3 clusters of sizes 8 | 6 | 6
Cluster means:
v1 v2 v3 v4 v5 v6
Cluster 1 5.75 3.62 6.00 3.12 1.88 3.88
Cluster 2 1.67 3.00 1.83 3.50 5.50 3.33
Cluster 3 3.50 5.83 3.33 6.00 3.50 6.00
Percentage of within cluster heterogeneity accounted for by each cluster:
Cluster 1 40.31%
Cluster 2 25.98%
Cluster 3 33.71%
Between cluster heterogeneity accounts for 73.93% of the
total heterogeneity in the data (higher is better)</code></pre>
<div class="sourceCode" id="cb28"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">result</span>, plots <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"density"</span>, <span class="st">"bar"</span><span class="op">)</span><span class="op">)</span></span></code></pre></div>
<p><img src="programming_files/figure-html/kclus-1.png" width="480"></p>
<div class="sourceCode" id="cb29"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">shopping</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://radiant-rstats.github.io/radiant.data/reference/store.html" class="external-link">store</a></span><span class="op">(</span><span class="va">shopping</span>, <span class="va">result</span>, name <span class="op">=</span> <span class="st">"clus"</span><span class="op">)</span></span>
<span></span>
<span><span class="co">## was the data really changed?</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/as.data.frame.html" class="external-link">as.data.frame</a></span><span class="op">(</span><span class="va">shopping</span><span class="op">)</span><span class="op">)</span></span></code></pre></div>
<pre><code> id v1 v2 v3 v4 v5 v6 clus
1 1 6 4 7 3 2 3 1
2 2 2 3 1 4 5 4 2
3 3 7 2 6 4 1 3 1
4 4 4 6 4 5 3 6 3
5 5 1 3 2 2 6 4 2
6 6 6 4 6 3 3 4 1</code></pre>
<p>See if you can reproduce this output in the radiant browser
interface. Start <code>Radiant</code> from the <code>Addins</code>
dropdown in Rstudio.</p>
<p>© Vincent Nijs (2023)
<a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" class="external-link"><img alt="Creative Commons License" style="border-width: 0" src="images/by-sa.png"></a></p>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
</div>
</div>
<footer><div class="copyright">
<p></p>
<p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer>
</div>
</body>
</html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Authors and Citation • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="bootstrap-toc.css"><script src="bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="pkgdown.css" rel="stylesheet"><script src="pkgdown.js"></script><meta property="og:title" content="Authors and Citation"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-citation-authors">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="contents col-md-9">
<div class="section level2 authors-section">
<div class="page-header">
<h1>Authors</h1>
</div>
<ul class="list-unstyled"><li>
<p><strong>Vincent Nijs</strong>. Author, maintainer.
</p>
</li>
</ul></div>
<div class="section level2 citation-section">
<div>
<h1 id="citation">Citation</h1>
<small class="dont-index">Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/DESCRIPTION" class="external-link"><code>DESCRIPTION</code></a></small>
</div>
</div>
<p>Nijs V (2023).
<em>radiant: Business Analytics using R and Shiny</em>.
R package version 1.6.0, <a href="https://github.com/radiant-rstats/radiant" class="external-link">https://github.com/radiant-rstats/radiant</a>.
</p>
<pre>@Manual{,
title = {radiant: Business Analytics using R and Shiny},
author = {Vincent Nijs},
year = {2023},
note = {R package version 1.6.0},
url = {https://github.com/radiant-rstats/radiant},
}</pre>
</div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
/*!
* Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/)
* Copyright 2015 Aidan Feldman
* Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */
/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */
/* All levels of nav */
nav[data-toggle='toc'] .nav > li > a {
display: block;
padding: 4px 20px;
font-size: 13px;
font-weight: 500;
color: #767676;
}
nav[data-toggle='toc'] .nav > li > a:hover,
nav[data-toggle='toc'] .nav > li > a:focus {
padding-left: 19px;
color: #563d7c;
text-decoration: none;
background-color: transparent;
border-left: 1px solid #563d7c;
}
nav[data-toggle='toc'] .nav > .active > a,
nav[data-toggle='toc'] .nav > .active:hover > a,
nav[data-toggle='toc'] .nav > .active:focus > a {
padding-left: 18px;
font-weight: bold;
color: #563d7c;
background-color: transparent;
border-left: 2px solid #563d7c;
}
/* Nav: second level (shown on .active) */
nav[data-toggle='toc'] .nav .nav {
display: none; /* Hide by default, but at >768px, show it */
padding-bottom: 10px;
}
nav[data-toggle='toc'] .nav .nav > li > a {
padding-top: 1px;
padding-bottom: 1px;
padding-left: 30px;
font-size: 12px;
font-weight: normal;
}
nav[data-toggle='toc'] .nav .nav > li > a:hover,
nav[data-toggle='toc'] .nav .nav > li > a:focus {
padding-left: 29px;
}
nav[data-toggle='toc'] .nav .nav > .active > a,
nav[data-toggle='toc'] .nav .nav > .active:hover > a,
nav[data-toggle='toc'] .nav .nav > .active:focus > a {
padding-left: 28px;
font-weight: 500;
}
/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */
nav[data-toggle='toc'] .nav > .active > ul {
display: block;
}
/*!
* Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/)
* Copyright 2015 Aidan Feldman
* Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */
(function() {
'use strict';
window.Toc = {
helpers: {
// return all matching elements in the set, or their descendants
findOrFilter: function($el, selector) {
// http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/
// http://stackoverflow.com/a/12731439/358804
var $descendants = $el.find(selector);
return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])');
},
generateUniqueIdBase: function(el) {
var text = $(el).text();
var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-');
return anchor || el.tagName.toLowerCase();
},
generateUniqueId: function(el) {
var anchorBase = this.generateUniqueIdBase(el);
for (var i = 0; ; i++) {
var anchor = anchorBase;
if (i > 0) {
// add suffix
anchor += '-' + i;
}
// check if ID already exists
if (!document.getElementById(anchor)) {
return anchor;
}
}
},
generateAnchor: function(el) {
if (el.id) {
return el.id;
} else {
var anchor = this.generateUniqueId(el);
el.id = anchor;
return anchor;
}
},
createNavList: function() {
return $('<ul class="nav"></ul>');
},
createChildNavList: function($parent) {
var $childList = this.createNavList();
$parent.append($childList);
return $childList;
},
generateNavEl: function(anchor, text) {
var $a = $('<a></a>');
$a.attr('href', '#' + anchor);
$a.text(text);
var $li = $('<li></li>');
$li.append($a);
return $li;
},
generateNavItem: function(headingEl) {
var anchor = this.generateAnchor(headingEl);
var $heading = $(headingEl);
var text = $heading.data('toc-text') || $heading.text();
return this.generateNavEl(anchor, text);
},
// Find the first heading level (`<h1>`, then `<h2>`, etc.) that has more than one element. Defaults to 1 (for `<h1>`).
getTopLevel: function($scope) {
for (var i = 1; i <= 6; i++) {
var $headings = this.findOrFilter($scope, 'h' + i);
if ($headings.length > 1) {
return i;
}
}
return 1;
},
// returns the elements for the top level, and the next below it
getHeadings: function($scope, topLevel) {
var topSelector = 'h' + topLevel;
var secondaryLevel = topLevel + 1;
var secondarySelector = 'h' + secondaryLevel;
return this.findOrFilter($scope, topSelector + ',' + secondarySelector);
},
getNavLevel: function(el) {
return parseInt(el.tagName.charAt(1), 10);
},
populateNav: function($topContext, topLevel, $headings) {
var $context = $topContext;
var $prevNav;
var helpers = this;
$headings.each(function(i, el) {
var $newNav = helpers.generateNavItem(el);
var navLevel = helpers.getNavLevel(el);
// determine the proper $context
if (navLevel === topLevel) {
// use top level
$context = $topContext;
} else if ($prevNav && $context === $topContext) {
// create a new level of the tree and switch to it
$context = helpers.createChildNavList($prevNav);
} // else use the current $context
$context.append($newNav);
$prevNav = $newNav;
});
},
parseOps: function(arg) {
var opts;
if (arg.jquery) {
opts = {
$nav: arg
};
} else {
opts = arg;
}
opts.$scope = opts.$scope || $(document.body);
return opts;
}
},
// accepts a jQuery object, or an options object
init: function(opts) {
opts = this.helpers.parseOps(opts);
// ensure that the data attribute is in place for styling
opts.$nav.attr('data-toggle', 'toc');
var $topContext = this.helpers.createChildNavList(opts.$nav);
var topLevel = this.helpers.getTopLevel(opts.$scope);
var $headings = this.helpers.getHeadings(opts.$scope, topLevel);
this.helpers.populateNav($topContext, topLevel, $headings);
}
};
$(function() {
$('nav[data-toggle="toc"]').each(function(i, el) {
var $nav = $(el);
Toc.init($nav);
});
});
})();
/* Docsearch -------------------------------------------------------------- */
/*
Source: https://github.com/algolia/docsearch/
License: MIT
*/
.algolia-autocomplete {
display: block;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1
}
.algolia-autocomplete .ds-dropdown-menu {
width: 100%;
min-width: none;
max-width: none;
padding: .75rem 0;
background-color: #fff;
background-clip: padding-box;
border: 1px solid rgba(0, 0, 0, .1);
box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175);
}
@media (min-width:768px) {
.algolia-autocomplete .ds-dropdown-menu {
width: 175%
}
}
.algolia-autocomplete .ds-dropdown-menu::before {
display: none
}
.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] {
padding: 0;
background-color: rgb(255,255,255);
border: 0;
max-height: 80vh;
}
.algolia-autocomplete .ds-dropdown-menu .ds-suggestions {
margin-top: 0
}
.algolia-autocomplete .algolia-docsearch-suggestion {
padding: 0;
overflow: visible
}
.algolia-autocomplete .algolia-docsearch-suggestion--category-header {
padding: .125rem 1rem;
margin-top: 0;
font-size: 1.3em;
font-weight: 500;
color: #00008B;
border-bottom: 0
}
.algolia-autocomplete .algolia-docsearch-suggestion--wrapper {
float: none;
padding-top: 0
}
.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column {
float: none;
width: auto;
padding: 0;
text-align: left
}
.algolia-autocomplete .algolia-docsearch-suggestion--content {
float: none;
width: auto;
padding: 0
}
.algolia-autocomplete .algolia-docsearch-suggestion--content::before {
display: none
}
.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header {
padding-top: .75rem;
margin-top: .75rem;
border-top: 1px solid rgba(0, 0, 0, .1)
}
.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column {
display: block;
padding: .1rem 1rem;
margin-bottom: 0.1;
font-size: 1.0em;
font-weight: 400
/* display: none */
}
.algolia-autocomplete .algolia-docsearch-suggestion--title {
display: block;
padding: .25rem 1rem;
margin-bottom: 0;
font-size: 0.9em;
font-weight: 400
}
.algolia-autocomplete .algolia-docsearch-suggestion--text {
padding: 0 1rem .5rem;
margin-top: -.25rem;
font-size: 0.8em;
font-weight: 400;
line-height: 1.25
}
.algolia-autocomplete .algolia-docsearch-footer {
width: 110px;
height: 20px;
z-index: 3;
margin-top: 10.66667px;
float: right;
font-size: 0;
line-height: 0;
}
.algolia-autocomplete .algolia-docsearch-footer--logo {
background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 130 18' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient x1='-36.868%' y1='134.936%' x2='129.432%' y2='-27.7%' id='a'><stop stop-color='%2300AEFF' offset='0%'/><stop stop-color='%233369E7' offset='100%'/></linearGradient></defs><g fill='none' fill-rule='evenodd'><path d='M59.399.022h13.299a2.372 2.372 0 0 1 2.377 2.364V15.62a2.372 2.372 0 0 1-2.377 2.364H59.399a2.372 2.372 0 0 1-2.377-2.364V2.381A2.368 2.368 0 0 1 59.399.022z' fill='url(%23a)'/><path d='M66.257 4.56c-2.815 0-5.1 2.272-5.1 5.078 0 2.806 2.284 5.072 5.1 5.072 2.815 0 5.1-2.272 5.1-5.078 0-2.806-2.279-5.072-5.1-5.072zm0 8.652c-1.983 0-3.593-1.602-3.593-3.574 0-1.972 1.61-3.574 3.593-3.574 1.983 0 3.593 1.602 3.593 3.574a3.582 3.582 0 0 1-3.593 3.574zm0-6.418v2.664c0 .076.082.131.153.093l2.377-1.226c.055-.027.071-.093.044-.147a2.96 2.96 0 0 0-2.465-1.487c-.055 0-.11.044-.11.104l.001-.001zm-3.33-1.956l-.312-.311a.783.783 0 0 0-1.106 0l-.372.37a.773.773 0 0 0 0 1.101l.307.305c.049.049.121.038.164-.011.181-.245.378-.479.597-.697.225-.223.455-.42.707-.599.055-.033.06-.109.016-.158h-.001zm5.001-.806v-.616a.781.781 0 0 0-.783-.779h-1.824a.78.78 0 0 0-.783.779v.632c0 .071.066.12.137.104a5.736 5.736 0 0 1 1.588-.223c.52 0 1.035.071 1.534.207a.106.106 0 0 0 .131-.104z' fill='%23FFF'/><path d='M102.162 13.762c0 1.455-.372 2.517-1.123 3.193-.75.676-1.895 1.013-3.44 1.013-.564 0-1.736-.109-2.673-.316l.345-1.689c.783.163 1.819.207 2.361.207.86 0 1.473-.174 1.84-.523.367-.349.548-.866.548-1.553v-.349a6.374 6.374 0 0 1-.838.316 4.151 4.151 0 0 1-1.194.158 4.515 4.515 0 0 1-1.616-.278 3.385 3.385 0 0 1-1.254-.817 3.744 3.744 0 0 1-.811-1.351c-.192-.539-.29-1.504-.29-2.212 0-.665.104-1.498.307-2.054a3.925 3.925 0 0 1 .904-1.433 4.124 4.124 0 0 1 1.441-.926 5.31 5.31 0 0 1 1.945-.365c.696 0 1.337.087 1.961.191a15.86 15.86 0 0 1 1.588.332v8.456h-.001zm-5.954-4.206c0 .893.197 1.885.592 2.299.394.414.904.621 1.528.621.34 0 .663-.049.964-.142a2.75 2.75 0 0 0 .734-.332v-5.29a8.531 8.531 0 0 0-1.413-.18c-.778-.022-1.369.294-1.786.801-.411.507-.619 1.395-.619 2.223zm16.12 0c0 .719-.104 1.264-.318 1.858a4.389 4.389 0 0 1-.904 1.52c-.389.42-.854.746-1.402.975-.548.229-1.391.36-1.813.36-.422-.005-1.26-.125-1.802-.36a4.088 4.088 0 0 1-1.397-.975 4.486 4.486 0 0 1-.909-1.52 5.037 5.037 0 0 1-.329-1.858c0-.719.099-1.411.318-1.999.219-.588.526-1.09.92-1.509.394-.42.865-.741 1.402-.97a4.547 4.547 0 0 1 1.786-.338 4.69 4.69 0 0 1 1.791.338c.548.229 1.019.55 1.402.97.389.42.69.921.909 1.509.23.588.345 1.28.345 1.999h.001zm-2.191.005c0-.921-.203-1.689-.597-2.223-.394-.539-.948-.806-1.654-.806-.707 0-1.26.267-1.654.806-.394.539-.586 1.302-.586 2.223 0 .932.197 1.558.592 2.098.394.545.948.812 1.654.812.707 0 1.26-.272 1.654-.812.394-.545.592-1.166.592-2.098h-.001zm6.962 4.707c-3.511.016-3.511-2.822-3.511-3.274L113.583.926l2.142-.338v10.003c0 .256 0 1.88 1.375 1.885v1.792h-.001zm3.774 0h-2.153V5.072l2.153-.338v9.534zm-1.079-10.542c.718 0 1.304-.578 1.304-1.291 0-.714-.581-1.291-1.304-1.291-.723 0-1.304.578-1.304 1.291 0 .714.586 1.291 1.304 1.291zm6.431 1.013c.707 0 1.304.087 1.786.262.482.174.871.42 1.156.73.285.311.488.735.608 1.182.126.447.186.937.186 1.476v5.481a25.24 25.24 0 0 1-1.495.251c-.668.098-1.419.147-2.251.147a6.829 6.829 0 0 1-1.517-.158 3.213 3.213 0 0 1-1.178-.507 2.455 2.455 0 0 1-.761-.904c-.181-.37-.274-.893-.274-1.438 0-.523.104-.855.307-1.215.208-.36.487-.654.838-.883a3.609 3.609 0 0 1 1.227-.49 7.073 7.073 0 0 1 2.202-.103c.263.027.537.076.833.147v-.349c0-.245-.027-.479-.088-.697a1.486 1.486 0 0 0-.307-.583c-.148-.169-.34-.3-.581-.392a2.536 2.536 0 0 0-.915-.163c-.493 0-.942.06-1.353.131-.411.071-.75.153-1.008.245l-.257-1.749c.268-.093.668-.185 1.183-.278a9.335 9.335 0 0 1 1.66-.142l-.001-.001zm.181 7.731c.657 0 1.145-.038 1.484-.104v-2.168a5.097 5.097 0 0 0-1.978-.104c-.241.033-.46.098-.652.191a1.167 1.167 0 0 0-.466.392c-.121.169-.175.267-.175.523 0 .501.175.79.493.981.323.196.75.289 1.293.289h.001zM84.109 4.794c.707 0 1.304.087 1.786.262.482.174.871.42 1.156.73.29.316.487.735.608 1.182.126.447.186.937.186 1.476v5.481a25.24 25.24 0 0 1-1.495.251c-.668.098-1.419.147-2.251.147a6.829 6.829 0 0 1-1.517-.158 3.213 3.213 0 0 1-1.178-.507 2.455 2.455 0 0 1-.761-.904c-.181-.37-.274-.893-.274-1.438 0-.523.104-.855.307-1.215.208-.36.487-.654.838-.883a3.609 3.609 0 0 1 1.227-.49 7.073 7.073 0 0 1 2.202-.103c.257.027.537.076.833.147v-.349c0-.245-.027-.479-.088-.697a1.486 1.486 0 0 0-.307-.583c-.148-.169-.34-.3-.581-.392a2.536 2.536 0 0 0-.915-.163c-.493 0-.942.06-1.353.131-.411.071-.75.153-1.008.245l-.257-1.749c.268-.093.668-.185 1.183-.278a8.89 8.89 0 0 1 1.66-.142l-.001-.001zm.186 7.736c.657 0 1.145-.038 1.484-.104v-2.168a5.097 5.097 0 0 0-1.978-.104c-.241.033-.46.098-.652.191a1.167 1.167 0 0 0-.466.392c-.121.169-.175.267-.175.523 0 .501.175.79.493.981.318.191.75.289 1.293.289h.001zm8.682 1.738c-3.511.016-3.511-2.822-3.511-3.274L89.461.926l2.142-.338v10.003c0 .256 0 1.88 1.375 1.885v1.792h-.001z' fill='%23182359'/><path d='M5.027 11.025c0 .698-.252 1.246-.757 1.644-.505.397-1.201.596-2.089.596-.888 0-1.615-.138-2.181-.414v-1.214c.358.168.739.301 1.141.397.403.097.778.145 1.125.145.508 0 .884-.097 1.125-.29a.945.945 0 0 0 .363-.779.978.978 0 0 0-.333-.747c-.222-.204-.68-.446-1.375-.725-.716-.29-1.221-.621-1.515-.994-.294-.372-.44-.82-.44-1.343 0-.655.233-1.171.698-1.547.466-.376 1.09-.564 1.875-.564.752 0 1.5.165 2.245.494l-.408 1.047c-.698-.294-1.321-.44-1.869-.44-.415 0-.73.09-.945.271a.89.89 0 0 0-.322.717c0 .204.043.379.129.524.086.145.227.282.424.411.197.129.551.299 1.063.51.577.24.999.464 1.268.671.269.208.466.442.591.704.125.261.188.569.188.924l-.001.002zm3.98 2.24c-.924 0-1.646-.269-2.167-.808-.521-.539-.782-1.281-.782-2.226 0-.97.242-1.733.725-2.288.483-.555 1.148-.833 1.993-.833.784 0 1.404.238 1.858.714.455.476.682 1.132.682 1.966v.682H7.357c.018.577.174 1.02.467 1.329.294.31.707.465 1.241.465.351 0 .678-.033.98-.099a5.1 5.1 0 0 0 .975-.33v1.026a3.865 3.865 0 0 1-.935.312 5.723 5.723 0 0 1-1.08.091l.002-.001zm-.231-5.199c-.401 0-.722.127-.964.381s-.386.625-.432 1.112h2.696c-.007-.491-.125-.862-.354-1.115-.229-.252-.544-.379-.945-.379l-.001.001zm7.692 5.092l-.252-.827h-.043c-.286.362-.575.608-.865.739-.29.131-.662.196-1.117.196-.584 0-1.039-.158-1.367-.473-.328-.315-.491-.761-.491-1.337 0-.612.227-1.074.682-1.386.455-.312 1.148-.482 2.079-.51l1.026-.032v-.317c0-.38-.089-.663-.266-.851-.177-.188-.452-.282-.824-.282-.304 0-.596.045-.876.134a6.68 6.68 0 0 0-.806.317l-.408-.902a4.414 4.414 0 0 1 1.058-.384 4.856 4.856 0 0 1 1.085-.132c.756 0 1.326.165 1.711.494.385.329.577.847.577 1.552v4.002h-.902l-.001-.001zm-1.88-.859c.458 0 .826-.128 1.104-.384.278-.256.416-.615.416-1.077v-.516l-.763.032c-.594.021-1.027.121-1.297.298s-.406.448-.406.814c0 .265.079.47.236.615.158.145.394.218.709.218h.001zm7.557-5.189c.254 0 .464.018.628.054l-.124 1.176a2.383 2.383 0 0 0-.559-.064c-.505 0-.914.165-1.227.494-.313.329-.47.757-.47 1.284v3.105h-1.262V7.218h.988l.167 1.047h.064c.197-.354.454-.636.771-.843a1.83 1.83 0 0 1 1.023-.312h.001zm4.125 6.155c-.899 0-1.582-.262-2.049-.787-.467-.525-.701-1.277-.701-2.259 0-.999.244-1.767.733-2.304.489-.537 1.195-.806 2.119-.806.627 0 1.191.116 1.692.349l-.381 1.015c-.534-.208-.974-.312-1.321-.312-1.028 0-1.542.682-1.542 2.046 0 .666.128 1.166.384 1.501.256.335.631.502 1.125.502a3.23 3.23 0 0 0 1.595-.419v1.101a2.53 2.53 0 0 1-.722.285 4.356 4.356 0 0 1-.932.086v.002zm8.277-.107h-1.268V9.506c0-.458-.092-.8-.277-1.026-.184-.226-.477-.338-.878-.338-.53 0-.919.158-1.168.475-.249.317-.373.848-.373 1.593v2.949h-1.262V4.801h1.262v2.122c0 .34-.021.704-.064 1.09h.081a1.76 1.76 0 0 1 .717-.666c.306-.158.663-.236 1.072-.236 1.439 0 2.159.725 2.159 2.175v3.873l-.001-.001zm7.649-6.048c.741 0 1.319.269 1.732.806.414.537.62 1.291.62 2.261 0 .974-.209 1.732-.628 2.275-.419.542-1.001.814-1.746.814-.752 0-1.336-.27-1.751-.811h-.086l-.231.704h-.945V4.801h1.262v1.987l-.021.655-.032.553h.054c.401-.591.992-.886 1.772-.886zm-.328 1.031c-.508 0-.875.149-1.098.448-.224.299-.339.799-.346 1.501v.086c0 .723.115 1.247.344 1.571.229.324.603.486 1.123.486.448 0 .787-.177 1.018-.532.231-.354.346-.867.346-1.536 0-1.35-.462-2.025-1.386-2.025l-.001.001zm3.244-.924h1.375l1.209 3.368c.183.48.304.931.365 1.354h.043c.032-.197.091-.436.177-.717.086-.281.541-1.616 1.364-4.004h1.364l-2.541 6.73c-.462 1.235-1.232 1.853-2.31 1.853-.279 0-.551-.03-.816-.091v-.999c.19.043.406.064.65.064.609 0 1.037-.353 1.284-1.058l.22-.559-2.385-5.941h.001z' fill='%231D3657'/></g></svg>");
background-repeat: no-repeat;
background-position: 50%;
background-size: 100%;
overflow: hidden;
text-indent: -9000px;
width: 100%;
height: 100%;
display: block;
transform: translate(-8px);
}
.algolia-autocomplete .algolia-docsearch-suggestion--highlight {
color: #FF8C00;
background: rgba(232, 189, 54, 0.1)
}
.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight {
box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5)
}
.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content {
background-color: rgba(192, 192, 192, .15)
}
$(function() {
// register a handler to move the focus to the search bar
// upon pressing shift + "/" (i.e. "?")
$(document).on('keydown', function(e) {
if (e.shiftKey && e.keyCode == 191) {
e.preventDefault();
$("#search-input").focus();
}
});
$(document).ready(function() {
// do keyword highlighting
/* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */
var mark = function() {
var referrer = document.URL ;
var paramKey = "q" ;
if (referrer.indexOf("?") !== -1) {
var qs = referrer.substr(referrer.indexOf('?') + 1);
var qs_noanchor = qs.split('#')[0];
var qsa = qs_noanchor.split('&');
var keyword = "";
for (var i = 0; i < qsa.length; i++) {
var currentParam = qsa[i].split('=');
if (currentParam.length !== 2) {
continue;
}
if (currentParam[0] == paramKey) {
keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20"));
}
}
if (keyword !== "") {
$(".contents").unmark({
done: function() {
$(".contents").mark(keyword);
}
});
}
}
};
mark();
});
});
/* Search term highlighting ------------------------------*/
function matchedWords(hit) {
var words = [];
var hierarchy = hit._highlightResult.hierarchy;
// loop to fetch from lvl0, lvl1, etc.
for (var idx in hierarchy) {
words = words.concat(hierarchy[idx].matchedWords);
}
var content = hit._highlightResult.content;
if (content) {
words = words.concat(content.matchedWords);
}
// return unique words
var words_uniq = [...new Set(words)];
return words_uniq;
}
function updateHitURL(hit) {
var words = matchedWords(hit);
var url = "";
if (hit.anchor) {
url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor;
} else {
url = hit.url + '?q=' + escape(words.join(" "));
}
return url;
}
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Business Analytics using R and Shiny • radiant</title>
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="bootstrap-toc.css">
<script src="bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="pkgdown.css" rel="stylesheet">
<script src="pkgdown.js"></script><meta property="og:title" content="Business Analytics using R and Shiny">
<meta property="og:description" content="A platform-independent browser-based interface for business
analytics in R, based on the shiny package. The application combines the
functionality of radiant.data, radiant.design, radiant.basics,
radiant.model, and radiant.multivariate.">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#toc">
<div class="container template-home">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="articles/programming.html">Programming with Radiant</a>
</li>
</ul>
</li>
<li>
<a href="news/index.html">Changelog</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container -->
</div>
<!--/.navbar -->
</header><div class="row">
<div class="contents col-md-9">
<div class="section level1">
<div class="page-header"><h1 id="radiant---business-analytics-using-r-and-shiny">Radiant - Business analytics using R and Shiny<a class="anchor" aria-label="anchor" href="#radiant---business-analytics-using-r-and-shiny"></a>
</h1></div>
<!-- [![Build Status](https://travis-ci.org/radiant-rstats/radiant.png?branch=master)](https://travis-ci.org/radiant-rstats/radiant) -->
<!-- [![Coverage Status](https://img.shields.io/coveralls/vnijs/radiant.svg)](https://coveralls.io/r/vnijs/radiant?branch=master) -->
<p><a href="https://CRAN.R-project.org/package=radiant" class="external-link"><img src="http://www.r-pkg.org/badges/version/radiant" alt="CRAN_Status_Badge"></a></p>
<p>Radiant is an open-source platform-independent browser-based interface for business analytics in <a href="https://www.r-project.org/" class="external-link">R</a>. The application is based on the <a href="https://shiny.posit.co/" class="external-link">Shiny</a> package and can be run locally or on a server. Radiant was developed by <a href="https://rady.ucsd.edu/faculty-research/faculty/vincent-nijs.html" target="\_blank" class="external-link">Vincent Nijs</a>. Please use the issue tracker on GitHub to suggest enhancements or report problems: <a href="https://github.com/radiant-rstats/radiant/issues" class="external-link uri">https://github.com/radiant-rstats/radiant/issues</a>. For other questions and comments please use <a href="mailto:radiant@rady.ucsd.edu" class="email">radiant@rady.ucsd.edu</a>.</p>
<div class="section level2">
<h2 id="key-features">Key features<a class="anchor" aria-label="anchor" href="#key-features"></a>
</h2>
<ul>
<li>Explore: Quickly and easily summarize, visualize, and analyze your data</li>
<li>Cross-platform: It runs in a browser on Windows, Mac, and Linux</li>
<li>Reproducible: Recreate results and share work with others as a state file or an <a href="https://rmarkdown.rstudio.com/" class="external-link">Rmarkdown</a> report</li>
<li>Programming: Integrate Radiant’s analysis functions with your own R-code</li>
<li>Context: Data and examples focus on business applications</li>
</ul>
<iframe width="640" height="375" src="https://www.youtube.com/embed/7L3hDpLw53I" frameborder="0" allowfullscreen>
</iframe>
<div class="section level4">
<h4 id="playlists">Playlists<a class="anchor" aria-label="anchor" href="#playlists"></a>
</h4>
<p>There are two youtube playlists with video tutorials. The first provides a general introduction to key features in Radiant. The second covers topics relevant in a course on business analytics (i.e., Probability, Decision Analysis, Hypothesis Testing, Linear Regression, and Simulation).</p>
<ul>
<li><a href="https://www.youtube.com/playlist?list=PLNhtaetb48EedDmWPUqytnQv-qxmCGtxi" target="_blank" class="external-link">Introduction to Radiant</a></li>
<li><a href="https://www.youtube.com/playlist?list=PLNhtaetb48EdKRIY7MewCyvb_1x7dV3xw" target="_blank" class="external-link">Radiant Tutorial Series</a></li>
</ul>
</div>
<div class="section level4">
<h4 id="explore">Explore<a class="anchor" aria-label="anchor" href="#explore"></a>
</h4>
<p>Radiant is interactive. Results update immediately when inputs are changed (i.e., no separate dialog boxes) and/or when a button is pressed (e.g., <code>Estimate</code> in <em>Model &gt; Estimate &gt; Logistic regression (GLM)</em>). This facilitates rapid exploration and understanding of the data.</p>
</div>
<div class="section level4">
<h4 id="cross-platform">Cross-platform<a class="anchor" aria-label="anchor" href="#cross-platform"></a>
</h4>
<p>Radiant works on Windows, Mac, or Linux. It can run without an Internet connection and no data will leave your computer. You can also run the app as a web application on a server.</p>
</div>
<div class="section level4">
<h4 id="reproducible">Reproducible<a class="anchor" aria-label="anchor" href="#reproducible"></a>
</h4>
<p>To conduct high-quality analysis, simply saving output is not enough. You need the ability to reproduce results for the same data and/or when new data become available. Moreover, others may want to review your analysis and results. Save and load the state of the application to continue your work at a later time or on another computer. Share state files with others and create reproducible reports using <a href="https://rmarkdown.rstudio.com/" class="external-link">Rmarkdown</a>. See also the section on <code>Saving and loading state</code> below</p>
<p>If you are using Radiant on a server you can even share the URL (include the SSUID) with others so they can see what you are working on. Thanks for this feature go to <a href="https://github.com/jcheng5" class="external-link">Joe Cheng</a>.</p>
</div>
<div class="section level4">
<h4 id="programming">Programming<a class="anchor" aria-label="anchor" href="#programming"></a>
</h4>
<p>Although Radiant’s web-interface can handle quite a few data and analysis tasks, you may prefer to write your own R-code. Radiant provides a bridge to programming in R(studio) by exporting the functions used for analysis (i.e., you can conduct your analysis using the Radiant web-interface or by calling Radiant’s functions directly from R-code). For more information about programming with Radiant see the <a href="https://radiant-rstats.github.io/docs/programming.html" class="external-link">programming</a> page on the documentation site.</p>
</div>
<div class="section level4">
<h4 id="context">Context<a class="anchor" aria-label="anchor" href="#context"></a>
</h4>
<p>Radiant focuses on business data and decisions. It offers tools, examples, and documentation relevant for that context, effectively reducing the business analytics learning curve.</p>
</div>
</div>
<div class="section level2">
<h2 id="how-to-install-radiant">How to install Radiant<a class="anchor" aria-label="anchor" href="#how-to-install-radiant"></a>
</h2>
<ul>
<li>Required: <a href="https://cran.r-project.org/" class="external-link">R</a> version 4.0.0 or later</li>
<li>Required: <a href="https://posit.co/download/rstudio-server/" class="external-link">Rstudio</a>
</li>
</ul>
<p>In Rstudio you can start and update Radiant through the <code>Addins</code> menu at the top of the screen. To install the latest version of Radiant for Windows or Mac, with complete documentation for off-line access, open R(studio) and copy-and-paste the command below:</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">options</a></span><span class="op">(</span>repos <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span>RSM <span class="op">=</span> <span class="st">"https://radiant-rstats.github.io/minicran"</span>, CRAN <span class="op">=</span> <span class="st">"https://cloud.r-project.org"</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html" class="external-link">install.packages</a></span><span class="op">(</span><span class="st">"radiant"</span><span class="op">)</span></span></code></pre></div>
<p>Once all packages are installed, select <code>Start radiant</code> from the <code>Addins</code> menu in Rstudio or use the command below to launch the app:</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu">radiant</span><span class="fu">::</span><span class="fu"><a href="reference/radiant.html">radiant</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p>To launch Radiant in Rstudio’s viewer pane use the command below:</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu">radiant</span><span class="fu">::</span><span class="fu"><a href="reference/radiant_viewer.html">radiant_viewer</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p>To launch Radiant in an Rstudio Window use the command below:</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu">radiant</span><span class="fu">::</span><span class="fu"><a href="reference/radiant_window.html">radiant_window</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p>To easily update Radiant and the required packages, install the <code>radiant.update</code> package using:</p>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">options</a></span><span class="op">(</span>repos <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span>RSM <span class="op">=</span> <span class="st">"https://radiant-rstats.github.io/minicran"</span>, CRAN <span class="op">=</span> <span class="st">"https://cloud.r-project.org"</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html" class="external-link">install.packages</a></span><span class="op">(</span><span class="st">"remotes"</span><span class="op">)</span></span>
<span><span class="fu">remotes</span><span class="fu">::</span><span class="fu"><a href="https://remotes.r-lib.org/reference/install_github.html" class="external-link">install_github</a></span><span class="op">(</span><span class="st">"radiant-rstats/radiant.update"</span>, upgrade <span class="op">=</span> <span class="st">"never"</span><span class="op">)</span></span></code></pre></div>
<p>Then select <code>Update radiant</code> from the <code>Addins</code> menu in Rstudio or use the command below:</p>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu">radiant.update</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/radiant.update/man/radiant.update.html" class="external-link">radiant.update</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p>See the <a href="https://radiant-rstats.github.io/docs/install.html" class="external-link">installing radiant</a> page additional for details.</p>
<p><strong>Optional:</strong> You can also create a launcher on your Desktop to start Radiant by typing <code><a href="reference/launcher.html">radiant::launcher()</a></code> in the R(studio) console and pressing return. A file called <code>radiant.bat</code> (windows) or <code>radiant.command</code> (mac) will be created that you can double-click to start Radiant in your default browser. The <code>launcher</code> command will also create a file called <code>update_radiant.bat</code> (windows) or <code>update_radiant.command</code> (mac) that you can double-click to update Radiant to the latest release.</p>
<p>When Radiant starts you will see data on diamond prices. To close the application click the <i title="Power off" class="fa fa-power-off"></i> icon in the navigation bar and then click <code>Stop</code>. The Radiant process will stop and the browser window will close (Chrome) or gray-out.</p>
</div>
<div class="section level2">
<h2 id="documentation">Documentation<a class="anchor" aria-label="anchor" href="#documentation"></a>
</h2>
<p>Documentation and tutorials are available at <a href="https://radiant-rstats.github.io/docs/" class="external-link uri">https://radiant-rstats.github.io/docs/</a> and in the Radiant web interface (the <i title="Help" class="fa fa-question"></i> icons on each page and the <i title="Help" class="fa fa-question-circle"></i> icon in the navigation bar).</p>
<p>Individual Radiant packages also each have their own <a href="https://github.com/r-lib/pkgdown" class="external-link">pkgdown</a> sites:</p>
<ul>
<li><a href="http://radiant-rstats.github.io/radiant" class="external-link uri">http://radiant-rstats.github.io/radiant</a></li>
<li><a href="http://radiant-rstats.github.io/radiant.data" class="external-link uri">http://radiant-rstats.github.io/radiant.data</a></li>
<li><a href="http://radiant-rstats.github.io/radiant.design" class="external-link uri">http://radiant-rstats.github.io/radiant.design</a></li>
<li><a href="http://radiant-rstats.github.io/radiant.basics" class="external-link uri">http://radiant-rstats.github.io/radiant.basics</a></li>
<li><a href="http://radiant-rstats.github.io/radiant.model" class="external-link uri">http://radiant-rstats.github.io/radiant.model</a></li>
<li><a href="http://radiant-rstats.github.io/radiant.multivariate" class="external-link uri">http://radiant-rstats.github.io/radiant.multivariate</a></li>
</ul>
<p>Want some help getting started? Watch the tutorials on the <a href="https://radiant-rstats.github.io/docs/tutorials.html" class="external-link">documentation site</a>.</p>
</div>
<div class="section level2">
<h2 id="reporting-issues">Reporting issues<a class="anchor" aria-label="anchor" href="#reporting-issues"></a>
</h2>
<p>Please use the GitHub issue tracker at <a href="https://github.com/radiant-rstats/radiant/issues" target="_blank" class="external-link">github.com/radiant-rstats/radiant/issues</a> if you have any problems using Radiant.</p>
</div>
<div class="section level2">
<h2 id="try-radiant-online">Try Radiant online<a class="anchor" aria-label="anchor" href="#try-radiant-online"></a>
</h2>
<p>Not ready to install Radiant on your computer? Try it online at the link below:</p>
<p><a href="https://vnijs.shinyapps.io/radiant" target="_blank" class="external-link">https://vnijs.shinyapps.io/radiant</a></p>
<p>Do <strong>not</strong> upload sensitive data to this public server. The size of data upload has been restricted to 10MB for security reasons.</p>
</div>
<div class="section level2">
<h2 id="running-radiant-on-shinyappsio">Running Radiant on shinyapps.io<a class="anchor" aria-label="anchor" href="#running-radiant-on-shinyappsio"></a>
</h2>
<p>To run your own instance of Radiant on shinyapps.io first <a href="https://radiant-rstats.github.io/docs/install.html" target="_blank" class="external-link">install Radiant and its dependencies</a>. Then clone the <a href="https://github.com/radiant-rstats/radiant" target="_blank" class="external-link">radiant</a> repo and ensure you have the latest version of the Radiant packages installed by running <code>radiant/inst/app/for.shinyapps.io.R</code>. Finally, open <code>radiant/inst/app/ui.R</code> and <a href="https://shiny.posit.co/articles/shinyapps.html" class="external-link">deploy</a> the application.</p>
</div>
<div class="section level2">
<h2 id="running-radiant-on-shiny-server">Running Radiant on shiny-server<a class="anchor" aria-label="anchor" href="#running-radiant-on-shiny-server"></a>
</h2>
<p>You can also host Radiant using <a href="https://posit.co/download/shiny-server/" class="external-link">shiny-server</a>. First, install radiant on the server using the command below:</p>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">options</a></span><span class="op">(</span>repos <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span>RSM <span class="op">=</span> <span class="st">"https://radiant-rstats.github.io/minicran"</span>, CRAN <span class="op">=</span> <span class="st">"https://cloud.r-project.org"</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html" class="external-link">install.packages</a></span><span class="op">(</span><span class="st">"radiant"</span><span class="op">)</span></span></code></pre></div>
<p>Then clone the <a href="https://github.com/radiant-rstats/radiant" target="_blank" class="external-link">radiant</a> repo and point shiny-server to the <code>inst/app/</code> directory. As a courtesy, please let me know if you intend to use Radiant on a server.</p>
<p>When running Radiant on a server, by default, file uploads are limited to 10MB and R-code in <em>Report &gt; Rmd</em> and <em>Report &gt; R</em> will not be evaluated for security reasons. If you have <code>sudo</code> access to the server and have appropriate security in place you can change these settings by adding the following lines to <code>.Rprofile</code> for the <code>shiny</code> user on the server.</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" tabindex="-1"></a><span class="ex">options</span><span class="er">(</span><span class="ex">radiant.maxRequestSize</span> = <span class="at">-1</span><span class="kw">)</span> <span class="co">## no file size limit</span></span>
<span id="cb8-2"><a href="#cb8-2" tabindex="-1"></a><span class="ex">options</span><span class="er">(</span><span class="ex">radiant.report</span> = TRUE<span class="kw">)</span></span></code></pre></div>
</div>
<div class="section level2">
<h2 id="running-radiant-in-the-cloud-eg-aws">Running Radiant in the cloud (e.g., AWS)<a class="anchor" aria-label="anchor" href="#running-radiant-in-the-cloud-eg-aws"></a>
</h2>
<p>To run radiant in the cloud you can use the customized Docker container. See <a href="https://github.com/radiant-rstats/docker" target="_blank" class="external-link">https://github.com/radiant-rstats/docker</a> for details</p>
</div>
<div class="section level2">
<h2 id="saving-and-loading-state">Saving and loading state<a class="anchor" aria-label="anchor" href="#saving-and-loading-state"></a>
</h2>
<p>To save your analyses save the state of the app to a file by clicking on the <i title="Save" class="fa fa-save"></i> icon in the navbar and then on <code>Save radiant state file</code> (see also the <em>Data &gt; Manage</em> tab). You can open this state file at a later time or on another computer to continue where you left off. You can also share the file with others that may want to replicate your analyses. As an example, load the state file <a href="https://radiant-rstats.github.io/docs/examples/radiant-example.state.rda" class="external-link"><code>radiant-example.state.rda</code></a> by clicking on the <i title="Save" class="fa fa-save"></i> icon in the navbar and then on <code>Load radiant state file</code>. Go to <em>Data &gt; View</em> and <em>Data &gt; Visualize</em> to see some of the settings from the previous “state” of the app. There is also a report in <em>Report &gt; Rmd</em> that was created using the Radiant interface. The html file <a href="https://radiant-rstats.github.io/docs/examples/radiant-example.nb.html" target="_blank" class="external-link"><code>radiant-example.nb.html</code></a> contains the output.</p>
<p>A related feature in Radiant is that state is maintained if you accidentally navigate to another web page, close (and reopen) the browser, and/or hit refresh. Use <code>Refresh</code> in the <i title="Power off" class="fa fa-power-off"></i> menu in the navigation bar to return to a clean/new state.</p>
<p>Loading and saving state also works with Rstudio. If you start Radiant from Rstudio and use <i title="Power off" class="fa fa-power-off"></i> &gt; <code>Stop</code> to stop the app, lists called <code>r_data</code>, <code>r_info</code>, and <code>r_state</code> will be put into Rstudio’s global workspace. If you start radiant again using <code><a href="reference/radiant.html">radiant::radiant()</a></code> it will use these lists to restore state. Also, if you load a state file directly into Rstudio it will be used when you start Radiant to recreate a previous state.</p>
<p><strong>Technical note</strong>: Loading state works as follows in Radiant: When an input is initialized in a Shiny app you set a default value in the call to, for example, numericInput. In Radiant, when a state file has been loaded and an input is initialized it looks to see if there is a value for an input of that name in a list called <code>r_state</code>. If there is, this value is used. The <code>r_state</code> list is created when saving state using <code>reactiveValuesToList(input)</code>. An example of a call to <code>numericInput</code> is given below where the <code>state_init</code> function from <code>radiant.R</code> is used to check if a value from <code>r_state</code> can be used.</p>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu">numericInput</span><span class="op">(</span><span class="st">"sm_comp_value"</span>, <span class="st">"Comparison value:"</span>, <span class="fu">state_init</span><span class="op">(</span><span class="st">"sm_comp_value"</span>, <span class="fl">0</span><span class="op">)</span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
<h2 id="source-code">Source code<a class="anchor" aria-label="anchor" href="#source-code"></a>
</h2>
<p>The source code for the radiant application is available on GitHub at <a href="https://github.com/radiant-rstats" class="external-link uri">https://github.com/radiant-rstats</a>. <code>radiant.data</code>, offers tools to load, save, view, visualize, summarize, combine, and transform data. <code>radiant.design</code> builds on <code>radiant.data</code> and adds tools for experimental design, sampling, and sample size calculation. <code>radiant.basics</code> covers the basics of statistical analysis (e.g., comparing means and proportions, cross-tabs, correlation, etc.) and includes a probability calculator. <code>radiant.model</code> covers model estimation (e.g., logistic regression and neural networks), model evaluation (e.g., gains chart, profit curve, confusion matrix, etc.), and decision tools (e.g., decision analysis and simulation). Finally, <code>radiant.multivariate</code> includes tools to generate brand maps and conduct cluster, factor, and conjoint analysis.</p>
<p>These tools are used in the <em>Business Analytics</em>, <em>Quantitative Analysis</em>, <em>Research for Marketing Decisions</em>, <em>Applied Market Research</em>, <em>Consumer Behavior</em>, <em>Experiments in Firms</em>, <em>Pricing</em>, <em>Pricing Analytics</em>, and <em>Customer Analytics</em> classes at the Rady School of Management (UCSD).</p>
</div>
<div class="section level2">
<h2 id="credits">Credits<a class="anchor" aria-label="anchor" href="#credits"></a>
</h2>
<p>Radiant would not be possible without <a href="https://cran.r-project.org/" class="external-link">R</a> and <a href="https://shiny.posit.co/" class="external-link">Shiny</a>. I would like to thank <a href="https://github.com/jcheng5" class="external-link">Joe Cheng</a>, <a href="https://github.com/wch" class="external-link">Winston Chang</a>, and <a href="https://github.com/yihui" class="external-link">Yihui Xie</a> for answering questions, providing suggestions, and creating amazing tools for the R community. Other key components used in Radiant are ggplot2, dplyr, tidyr, magrittr, broom, shinyAce, shinyFiles, rmarkdown, and DT. For an overview of other packages that Radiant relies on please see the <a href="https://radiant-rstats.github.io/docs/about.html" target="_blank" class="external-link">about</a> page.</p>
</div>
<div class="section level2">
<h2 id="license">License<a class="anchor" aria-label="anchor" href="#license"></a>
</h2>
<p>Radiant is licensed under the <a href="https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)" target="\_blank" class="external-link">AGPLv3</a>. As a summary, the AGPLv3 license requires, attribution, including copyright and license information in copies of the software, stating changes if the code is modified, and disclosure of all source code. Details are in the COPYING file.</p>
<p>The documentation, images, and videos for the <code>radiant.data</code> package are licensed under the creative commons attribution and share-alike license <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" class="external-link">CC-BY-SA</a>. All other documentation and videos on this site, as well as the help files for <code>radiant.design</code>, <code>radiant.basics</code>, <code>radiant.model</code>, and <code>radiant.multivariate</code>, are licensed under the creative commons attribution, non-commercial, share-alike license <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" class="external-link">CC-NC-SA</a>.</p>
<p>If you are interested in using any of the radiant packages please email me at <a href="mailto:radiant@rady.ucsd.edu" class="email">radiant@rady.ucsd.edu</a></p>
<p>© Vincent Nijs (2023) <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" class="external-link"><img alt="Creative Commons License" style="border-width:0" src="https://radiant-rstats.github.io/docs/images/by-sa.png"></a></p>
</div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<div class="links">
<h2 data-toc-skip>Links</h2>
<ul class="list-unstyled">
<li><a href="https://cloud.r-project.org/package=radiant" class="external-link">View on CRAN</a></li>
<li><a href="https://github.com/radiant-rstats/radiant/" class="external-link">Browse source code</a></li>
<li><a href="https://github.com/radiant-rstats/radiant/issues" class="external-link">Report a bug</a></li>
</ul>
</div>
<div class="license">
<h2 data-toc-skip>License</h2>
<ul class="list-unstyled">
<li>
<a href="https://www.r-project.org/Licenses/AGPL-3" class="external-link">AGPL-3</a> | file <a href="LICENSE-text.html">LICENSE</a>
</li>
</ul>
</div>
<div class="citation">
<h2 data-toc-skip>Citation</h2>
<ul class="list-unstyled">
<li><a href="authors.html#citation">Citing radiant</a></li>
</ul>
</div>
<div class="developers">
<h2 data-toc-skip>Developers</h2>
<ul class="list-unstyled">
<li>Vincent Nijs <br><small class="roles"> Author, maintainer </small> </li>
</ul>
</div>
</div>
</div>
<footer><div class="copyright">
<p></p>
<p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer>
</div>
</body>
</html>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve">
<style type="text/css">
.st0{fill:#75AADB;}
</style>
<path class="st0" d="M4,11.3h1.3v1.3H4c-2,0-4-2.3-4-4.7s2.1-4.7,4-4.7h5.3c1.9,0,4,2.3,4,4.7c0,1.9-1.2,3.6-2.7,4.3v-1.5
C11.4,10.2,12,9.1,12,8c0-1.7-1.4-3.3-2.7-3.3H4C2.7,4.7,1.3,6.3,1.3,8S2.7,11.3,4,11.3z M16,7.3h-1.3v1.3H16c1.3,0,2.7,1.6,2.7,3.3
s-1.4,3.3-2.7,3.3h-5.3C9.4,15.3,8,13.7,8,12c0-1.1,0.6-2.2,1.3-2.8V7.7C7.9,8.4,6.7,10.1,6.7,12c0,2.4,2.1,4.7,4,4.7H16
c1.9,0,4-2.3,4-4.7S18,7.3,16,7.3z"/>
</svg>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Changelog • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Changelog"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-news">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1 data-toc-skip>Changelog <small></small></h1>
<small>Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/NEWS.md" class="external-link"><code>NEWS.md</code></a></small>
</div>
<div class="section level2">
<h2 class="page-header" data-toc-text="1.5.0.0" id="radiant-1500">radiant 1.5.0.0<a class="anchor" aria-label="anchor" href="#radiant-1500"></a></h2>
<ul><li>Required 1.5.0 of all radiant packages to ensure users can access the new functionality added to other radiant packages</li>
</ul></div>
<div class="section level2">
<h2 class="page-header" data-toc-text="1.4.4.0" id="radiant-1440">radiant 1.4.4.0<a class="anchor" aria-label="anchor" href="#radiant-1440"></a></h2>
<ul><li>Required 1.4.4 of all radiant packages (1.4.6 for radiant.model) to ensure users can create screenshots of application settings in the shiny interface for all radiant modules</li>
</ul></div>
<div class="section level2">
<h2 class="page-header" data-toc-text="1.4.2.0" id="radiant-1420">radiant 1.4.2.0<a class="anchor" aria-label="anchor" href="#radiant-1420"></a></h2>
<ul><li>Documentation updates</li>
<li>Fix and improvements for launcher issue on windows, mac, and linux when not using Rstudio. Will pickup Quarto (Pandoc) if installed</li>
</ul></div>
<div class="section level2">
<h2 class="page-header" data-toc-text="1.4.0.0" id="radiant-1400">radiant 1.4.0.0<a class="anchor" aria-label="anchor" href="#radiant-1400"></a></h2>
<ul><li>Adding the markdown package to <code>suggests</code> fixes <a href="https://github.com/radiant-rstats/radiant/issues/153" class="external-link uri">https://github.com/radiant-rstats/radiant/issues/153</a>
</li>
</ul></div>
<div class="section level2">
<h2 class="page-header" data-toc-text="1.3.1.0" id="radiant-1310">radiant 1.3.1.0<a class="anchor" aria-label="anchor" href="#radiant-1310"></a></h2>
<ul><li>Added launch option that only shows a URL. Convenient for VSCode to launch Radiant in an external browser</li>
<li>Using <code><a href="https://rdrr.io/pkg/polycor/man/hetcor.html" class="external-link">polycor::hetcor</a></code> to calculate measures of correlation between numeric and categorical variables</li>
<li>Using <code>patchwork</code> to combine multiple plots</li>
</ul></div>
<div class="section level2">
<h2 class="page-header" data-toc-text="1.2.0.0" id="radiant-1200">radiant 1.2.0.0<a class="anchor" aria-label="anchor" href="#radiant-1200"></a></h2>
<ul><li>Documentation updates</li>
<li>Upgrade dependency to shiny 1.4.0</li>
<li>Improved handling of fractions in radiant.design, radiant.basics, and radiant.model</li>
<li>Improved button refresh code when relevant inputs are changed by the user</li>
</ul></div>
<div class="section level2">
<h2 class="page-header" data-toc-text="1.1.0.0" id="radiant-1100">radiant 1.1.0.0<a class="anchor" aria-label="anchor" href="#radiant-1100"></a></h2>
<ul><li>Numerous small code changes to support enhanced auto-completion, tooltips, and annotations in shinyAce 0.4.1</li>
</ul></div>
<div class="section level2">
<h2 class="page-header" data-toc-text="0.9.9.0" id="radiant-0990">radiant 0.9.9.0<a class="anchor" aria-label="anchor" href="#radiant-0990"></a></h2>
<ul><li>Option to pass additional arguments to <code><a href="https://rdrr.io/pkg/shiny/man/runApp.html" class="external-link">shiny::runApp</a></code> when starting radiant such as the port to use. For example, radiant::radiant(“<a href="https://github.com/radiant-rstats/docs/raw/gh-pages/examples/demo-dvd-rnd.state.rda" class="external-link uri">https://github.com/radiant-rstats/docs/raw/gh-pages/examples/demo-dvd-rnd.state.rda</a>”, port = 8080)</li>
<li>Load a state file on startup by providing a (relative) file path or a url. For example, radiant::radiant(“<a href="https://github.com/radiant-rstats/docs/raw/gh-pages/examples/demo-dvd-rnd.state.rda" class="external-link uri">https://github.com/radiant-rstats/docs/raw/gh-pages/examples/demo-dvd-rnd.state.rda</a>”)</li>
<li>Update dependencies and convert all package data to tibbles</li>
</ul></div>
<div class="section level2">
<h2 class="page-header" data-toc-text="0.9.6.0" id="radiant-0960">radiant 0.9.6.0<a class="anchor" aria-label="anchor" href="#radiant-0960"></a></h2>
<ul><li>Remove <code>rstudioapi</code>, <code>psych</code>, and <code>AlgDesign</code> as a direct imports</li>
</ul></div>
<div class="section level2">
<h2 class="page-header" data-toc-text="0.9.5.0" id="radiant-0950">radiant 0.9.5.0<a class="anchor" aria-label="anchor" href="#radiant-0950"></a></h2>
<div class="section level3">
<h3 id="major-changes-0-9-5-0">Major changes<a class="anchor" aria-label="anchor" href="#major-changes-0-9-5-0"></a></h3>
<ul><li>When using radiant with Rstudio Viewer or in an Rstudio Window, loading and saving data through <em>Data &gt; Manage</em> generates R-code the user can add to <em>Report &gt; Rmd</em> or <em>Report &gt; R</em>. Clicking the <code>Show R-code</code> checkbox displays the R-code used to load or save the current dataset</li>
<li>Added <code>load_clip</code> and <code>save_clip</code> to load and save data to the clipboard on Windows and macOS</li>
<li>Various changes to the code to accommodate the use of <code><a href="https://rdrr.io/pkg/shiny/man/makeReactiveBinding.html" class="external-link">shiny::makeReactiveBinding</a></code>. The advantage is that the code generated for <em>Report &gt; Rmd</em> and <em>Report &gt; R</em> will no longer have to use <code>r_data</code> to store and access data. This means that code generated and used in the Radiant browser interface will be directly usable without the browser interface as well.</li>
<li>Improved auto completion in <em>Report &gt; Rmd</em> and <em>Report &gt; R</em>
</li>
</ul></div>
</div>
<div class="section level2">
<h2 class="page-header" data-toc-text="0.9.2.0" id="radiant-0920">radiant 0.9.2.0<a class="anchor" aria-label="anchor" href="#radiant-0920"></a></h2>
<div class="section level3">
<h3 id="major-changes-0-9-2-0">Major changes<a class="anchor" aria-label="anchor" href="#major-changes-0-9-2-0"></a></h3>
<ul><li>
<code>Estimate model</code> buttons update when model input changes so the user know to re-estimate the model</li>
<li>Upload and download data using the Rstudio file browser. Allows using relative paths to files (e.g., data or images inside an Rstudio project)</li>
<li>Moved <code>update_radiant</code> function to a separate package. The new function is radiant.update::radiant.update() and can be installed using:</li>
</ul><p>install.packages(“radiant.update”, repos = “<a href="https://radiant-rstats.github.io/minicran/" class="external-link uri">https://radiant-rstats.github.io/minicran/</a>”)</p>
</div>
<div class="section level3">
<h3 id="minor-changes-0-9-2-0">Minor changes<a class="anchor" aria-label="anchor" href="#minor-changes-0-9-2-0"></a></h3>
<ul><li>Addins option to start app in Rstudio window</li>
</ul></div>
</div>
<div class="section level2">
<h2 class="page-header" data-toc-text="0.9.0.0" id="radiant-0900">radiant 0.9.0.0<a class="anchor" aria-label="anchor" href="#radiant-0900"></a></h2>
<div class="section level3">
<h3 id="minor-changes-0-9-0-0">Minor changes<a class="anchor" aria-label="anchor" href="#minor-changes-0-9-0-0"></a></h3>
<ul><li>Addins to launch in default browser or Rstudio viewer</li>
<li>Improved <code>update_radiant</code> function for Windows and Mac</li>
<li>Suppress package start-up messages</li>
<li>Show Rstudio project information in navbar if available</li>
<li>Option to start Radiant in Browser or Rstudio Viewer</li>
<li>Applied <code>styler</code> to code</li>
</ul></div>
</div>
<div class="section level2">
<h2 class="page-header" data-toc-text="0.8.7.4" id="radiant-0874">radiant 0.8.7.4<a class="anchor" aria-label="anchor" href="#radiant-0874"></a></h2>
<div class="section level3">
<h3 id="minor-changes-0-8-7-4">Minor changes<a class="anchor" aria-label="anchor" href="#minor-changes-0-8-7-4"></a></h3>
<ul><li>Upgraded tidyr dependency to 0.7</li>
<li>Upgraded dplyr dependency to 0.7.1</li>
</ul></div>
</div>
<div class="section level2">
<h2 class="page-header" data-toc-text="0.8.2" id="radiant-version-082">radiant VERSION 0.8.2<a class="anchor" aria-label="anchor" href="#radiant-version-082"></a></h2>
<div class="section level3">
<h3 id="minor-changes-0-8-2">Minor changes<a class="anchor" aria-label="anchor" href="#minor-changes-0-8-2"></a></h3>
<p>Updated dependency requirements for radiant menus contained in packages radiant.data, radiant.design, radiant.basics, radiant.model, and radiant.multivariate. See the NEWS.md files for those packages for additional information about changes.</p>
</div>
</div>
<div class="section level2">
<h2 class="page-header" data-toc-text="0.8.1" id="radiant-version-081">radiant VERSION 0.8.1<a class="anchor" aria-label="anchor" href="#radiant-version-081"></a></h2>
<div class="section level3">
<h3 id="minor-changes-0-8-1">Minor changes<a class="anchor" aria-label="anchor" href="#minor-changes-0-8-1"></a></h3>
<ul><li>Added a check to see if radiant::update_radiant() is running in Rstudio</li>
<li>Updated dependency requirements for radiant menus contained in packages radiant.data, radiant.design, radiant.basics, radiant.model, and radiant.multivariate. See the NEWS.md files for those packages for additional information about changes.</li>
</ul></div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
/* Sticky footer */
/**
* Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/
* Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css
*
* .Site -> body > .container
* .Site-content -> body > .container .row
* .footer -> footer
*
* Key idea seems to be to ensure that .container and __all its parents__
* have height set to 100%
*
*/
html, body {
height: 100%;
}
body {
position: relative;
}
body > .container {
display: flex;
height: 100%;
flex-direction: column;
}
body > .container .row {
flex: 1 0 auto;
}
footer {
margin-top: 45px;
padding: 35px 0 36px;
border-top: 1px solid #e5e5e5;
color: #666;
display: flex;
flex-shrink: 0;
}
footer p {
margin-bottom: 0;
}
footer div {
flex: 1;
}
footer .pkgdown {
text-align: right;
}
footer p {
margin-bottom: 0;
}
img.icon {
float: right;
}
/* Ensure in-page images don't run outside their container */
.contents img {
max-width: 100%;
height: auto;
}
/* Fix bug in bootstrap (only seen in firefox) */
summary {
display: list-item;
}
/* Typographic tweaking ---------------------------------*/
.contents .page-header {
margin-top: calc(-60px + 1em);
}
dd {
margin-left: 3em;
}
/* Section anchors ---------------------------------*/
a.anchor {
display: none;
margin-left: 5px;
width: 20px;
height: 20px;
background-image: url(./link.svg);
background-repeat: no-repeat;
background-size: 20px 20px;
background-position: center center;
}
h1:hover .anchor,
h2:hover .anchor,
h3:hover .anchor,
h4:hover .anchor,
h5:hover .anchor,
h6:hover .anchor {
display: inline-block;
}
/* Fixes for fixed navbar --------------------------*/
.contents h1, .contents h2, .contents h3, .contents h4 {
padding-top: 60px;
margin-top: -40px;
}
/* Navbar submenu --------------------------*/
.dropdown-submenu {
position: relative;
}
.dropdown-submenu>.dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover>.dropdown-menu {
display: block;
}
.dropdown-submenu>a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 5px 0 5px 5px;
border-left-color: #cccccc;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
border-left-color: #ffffff;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
left: -100%;
margin-left: 10px;
border-radius: 6px 0 6px 6px;
}
/* Sidebar --------------------------*/
#pkgdown-sidebar {
margin-top: 30px;
position: -webkit-sticky;
position: sticky;
top: 70px;
}
#pkgdown-sidebar h2 {
font-size: 1.5em;
margin-top: 1em;
}
#pkgdown-sidebar h2:first-child {
margin-top: 0;
}
#pkgdown-sidebar .list-unstyled li {
margin-bottom: 0.5em;
}
/* bootstrap-toc tweaks ------------------------------------------------------*/
/* All levels of nav */
nav[data-toggle='toc'] .nav > li > a {
padding: 4px 20px 4px 6px;
font-size: 1.5rem;
font-weight: 400;
color: inherit;
}
nav[data-toggle='toc'] .nav > li > a:hover,
nav[data-toggle='toc'] .nav > li > a:focus {
padding-left: 5px;
color: inherit;
border-left: 1px solid #878787;
}
nav[data-toggle='toc'] .nav > .active > a,
nav[data-toggle='toc'] .nav > .active:hover > a,
nav[data-toggle='toc'] .nav > .active:focus > a {
padding-left: 5px;
font-size: 1.5rem;
font-weight: 400;
color: inherit;
border-left: 2px solid #878787;
}
/* Nav: second level (shown on .active) */
nav[data-toggle='toc'] .nav .nav {
display: none; /* Hide by default, but at >768px, show it */
padding-bottom: 10px;
}
nav[data-toggle='toc'] .nav .nav > li > a {
padding-left: 16px;
font-size: 1.35rem;
}
nav[data-toggle='toc'] .nav .nav > li > a:hover,
nav[data-toggle='toc'] .nav .nav > li > a:focus {
padding-left: 15px;
}
nav[data-toggle='toc'] .nav .nav > .active > a,
nav[data-toggle='toc'] .nav .nav > .active:hover > a,
nav[data-toggle='toc'] .nav .nav > .active:focus > a {
padding-left: 15px;
font-weight: 500;
font-size: 1.35rem;
}
/* orcid ------------------------------------------------------------------- */
.orcid {
font-size: 16px;
color: #A6CE39;
/* margins are required by official ORCID trademark and display guidelines */
margin-left:4px;
margin-right:4px;
vertical-align: middle;
}
/* Reference index & topics ----------------------------------------------- */
.ref-index th {font-weight: normal;}
.ref-index td {vertical-align: top; min-width: 100px}
.ref-index .icon {width: 40px;}
.ref-index .alias {width: 40%;}
.ref-index-icons .alias {width: calc(40% - 40px);}
.ref-index .title {width: 60%;}
.ref-arguments th {text-align: right; padding-right: 10px;}
.ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px}
.ref-arguments .name {width: 20%;}
.ref-arguments .desc {width: 80%;}
/* Nice scrolling for wide elements --------------------------------------- */
table {
display: block;
overflow: auto;
}
/* Syntax highlighting ---------------------------------------------------- */
pre, code, pre code {
background-color: #f8f8f8;
color: #333;
}
pre, pre code {
white-space: pre-wrap;
word-break: break-all;
overflow-wrap: break-word;
}
pre {
border: 1px solid #eee;
}
pre .img, pre .r-plt {
margin: 5px 0;
}
pre .img img, pre .r-plt img {
background-color: #fff;
}
code a, pre a {
color: #375f84;
}
a.sourceLine:hover {
text-decoration: none;
}
.fl {color: #1514b5;}
.fu {color: #000000;} /* function */
.ch,.st {color: #036a07;} /* string */
.kw {color: #264D66;} /* keyword */
.co {color: #888888;} /* comment */
.error {font-weight: bolder;}
.warning {font-weight: bolder;}
/* Clipboard --------------------------*/
.hasCopyButton {
position: relative;
}
.btn-copy-ex {
position: absolute;
right: 0;
top: 0;
visibility: hidden;
}
.hasCopyButton:hover button.btn-copy-ex {
visibility: visible;
}
/* headroom.js ------------------------ */
.headroom {
will-change: transform;
transition: transform 200ms linear;
}
.headroom--pinned {
transform: translateY(0%);
}
.headroom--unpinned {
transform: translateY(-100%);
}
/* mark.js ----------------------------*/
mark {
background-color: rgba(255, 255, 51, 0.5);
border-bottom: 2px solid rgba(255, 153, 51, 0.3);
padding: 1px;
}
/* vertical spacing after htmlwidgets */
.html-widget {
margin-bottom: 10px;
}
/* fontawesome ------------------------ */
.fab {
font-family: "Font Awesome 5 Brands" !important;
}
/* don't display links in code chunks when printing */
/* source: https://stackoverflow.com/a/10781533 */
@media print {
code a:link:after, code a:visited:after {
content: "";
}
}
/* Section anchors ---------------------------------
Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71
*/
div.csl-bib-body { }
div.csl-entry {
clear: both;
}
.hanging-indent div.csl-entry {
margin-left:2em;
text-indent:-2em;
}
div.csl-left-margin {
min-width:2em;
float:left;
}
div.csl-right-inline {
margin-left:2em;
padding-left:1em;
}
div.csl-indent {
margin-left: 2em;
}
/* http://gregfranko.com/blog/jquery-best-practices/ */
(function($) {
$(function() {
$('.navbar-fixed-top').headroom();
$('body').css('padding-top', $('.navbar').height() + 10);
$(window).resize(function(){
$('body').css('padding-top', $('.navbar').height() + 10);
});
$('[data-toggle="tooltip"]').tooltip();
var cur_path = paths(location.pathname);
var links = $("#navbar ul li a");
var max_length = -1;
var pos = -1;
for (var i = 0; i < links.length; i++) {
if (links[i].getAttribute("href") === "#")
continue;
// Ignore external links
if (links[i].host !== location.host)
continue;
var nav_path = paths(links[i].pathname);
var length = prefix_length(nav_path, cur_path);
if (length > max_length) {
max_length = length;
pos = i;
}
}
// Add class to parent <li>, and enclosing <li> if in dropdown
if (pos >= 0) {
var menu_anchor = $(links[pos]);
menu_anchor.parent().addClass("active");
menu_anchor.closest("li.dropdown").addClass("active");
}
});
function paths(pathname) {
var pieces = pathname.split("/");
pieces.shift(); // always starts with /
var end = pieces[pieces.length - 1];
if (end === "index.html" || end === "")
pieces.pop();
return(pieces);
}
// Returns -1 if not found
function prefix_length(needle, haystack) {
if (needle.length > haystack.length)
return(-1);
// Special case for length-0 haystack, since for loop won't run
if (haystack.length === 0) {
return(needle.length === 0 ? 0 : -1);
}
for (var i = 0; i < haystack.length; i++) {
if (needle[i] != haystack[i])
return(i);
}
return(haystack.length);
}
/* Clipboard --------------------------*/
function changeTooltipMessage(element, msg) {
var tooltipOriginalTitle=element.getAttribute('data-original-title');
element.setAttribute('data-original-title', msg);
$(element).tooltip('show');
element.setAttribute('data-original-title', tooltipOriginalTitle);
}
if(ClipboardJS.isSupported()) {
$(document).ready(function() {
var copyButton = "<button type='button' class='btn btn-primary btn-copy-ex' type = 'submit' title='Copy to clipboard' aria-label='Copy to clipboard' data-toggle='tooltip' data-placement='left auto' data-trigger='hover' data-clipboard-copy><i class='fa fa-copy'></i></button>";
$("div.sourceCode").addClass("hasCopyButton");
// Insert copy buttons:
$(copyButton).prependTo(".hasCopyButton");
// Initialize tooltips:
$('.btn-copy-ex').tooltip({container: 'body'});
// Initialize clipboard:
var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', {
text: function(trigger) {
return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, "");
}
});
clipboardBtnCopies.on('success', function(e) {
changeTooltipMessage(e.trigger, 'Copied!');
e.clearSelection();
});
clipboardBtnCopies.on('error', function() {
changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy');
});
});
}
})(window.jQuery || window.$)
pandoc: 3.1.2
pkgdown: 2.0.7
pkgdown_sha: ~
articles:
programming: programming.html
last_built: 2023-09-06T06:53Z
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Function reference • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Function reference"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-reference-index">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="contents col-md-9">
<div class="page-header">
<h1>Reference</h1>
</div>
<table class="ref-index"><colgroup><col class="alias"><col class="title"></colgroup><tbody><tr><th colspan="2">
<h2 id="all-functions">All functions <a href="#all-functions" class="anchor" aria-hidden="true"></a></h2>
<p class="section-desc"></p>
</th>
</tr></tbody><tbody><tr><td>
<p><code><a href="launcher.html">launcher()</a></code> </p>
</td>
<td><p>Create a launcher on the desktop for Windows (.bat), Mac (.command), or Linux (.sh)</p></td>
</tr><tr><td>
<p><code><a href="lin_launcher.html">lin_launcher()</a></code> </p>
</td>
<td><p>Create a launcher and updater for Linux (.sh)</p></td>
</tr><tr><td>
<p><code><a href="mac_launcher.html">mac_launcher()</a></code> </p>
</td>
<td><p>Create a launcher and updater for Mac (.command)</p></td>
</tr><tr><td>
<p><code><a href="radiant.html">radiant()</a></code> </p>
</td>
<td><p>radiant</p></td>
</tr><tr><td>
<p><code><a href="radiant_url.html">radiant_url()</a></code> </p>
</td>
<td><p>Start radiant but do not open a browser</p></td>
</tr><tr><td>
<p><code><a href="radiant_viewer.html">radiant_viewer()</a></code> </p>
</td>
<td><p>Launch radiant in the Rstudio viewer</p></td>
</tr><tr><td>
<p><code><a href="radiant_window.html">radiant_window()</a></code> </p>
</td>
<td><p>Launch radiant in an Rstudio window</p></td>
</tr><tr><td>
<p><code><a href="win_launcher.html">win_launcher()</a></code> </p>
</td>
<td><p>Create a launcher and updater for Windows (.bat)</p></td>
</tr></tbody></table></div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Create a launcher on the desktop for Windows (.bat), Mac (.command), or Linux (.sh) — launcher • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Create a launcher on the desktop for Windows (.bat), Mac (.command), or Linux (.sh) — launcher"><meta property="og:description" content="Create a launcher on the desktop for Windows (.bat), Mac (.command), or Linux (.sh)"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-reference-topic">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Create a launcher on the desktop for Windows (.bat), Mac (.command), or Linux (.sh)</h1>
<small class="dont-index">Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/R/radiant.R" class="external-link"><code>R/radiant.R</code></a></small>
<div class="hidden name"><code>launcher.Rd</code></div>
</div>
<div class="ref-description">
<p>Create a launcher on the desktop for Windows (.bat), Mac (.command), or Linux (.sh)</p>
</div>
<div id="ref-usage">
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">launcher</span><span class="op">(</span></span>
<span> app <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"radiant"</span>, <span class="st">"radiant.data"</span>, <span class="st">"radiant.design"</span>, <span class="st">"radiant.basics"</span>, <span class="st">"radiant.model"</span>,</span>
<span> <span class="st">"radiant.multivariate"</span><span class="op">)</span>,</span>
<span> port <span class="op">=</span> <span class="fl">4444</span>,</span>
<span> pdir <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/Sys.getenv.html" class="external-link">Sys.getenv</a></span><span class="op">(</span><span class="st">"HOME"</span><span class="op">)</span></span>
<span><span class="op">)</span></span></code></pre></div>
</div>
<div id="arguments">
<h2>Arguments</h2>
<dl><dt>app</dt>
<dd><p>App to run when the desktop icon is double-clicked ("analytics", "marketing", "quant", or "base"). Default is "analytics"</p></dd>
<dt>port</dt>
<dd><p>Port to use for shiny::runApp (e.g, port = 4444)</p></dd>
<dt>pdir</dt>
<dd><p>Project directory to use. Default is Sys.getenv("HOME")</p></dd>
</dl></div>
<div id="details">
<h2>Details</h2>
<p>On Windows/Mac/Linux a file named radiant.bat/radiant.command/radiant.sh will be put on the desktop. Double-click the file to launch the specified Radiant app</p>
</div>
<div id="see-also">
<h2>See also</h2>
<div class="dont-index"><p><code><a href="win_launcher.html">win_launcher</a></code> to create a shortcut on Windows</p>
<p><code><a href="mac_launcher.html">mac_launcher</a></code> to create a shortcut on Mac</p>
<p><code><a href="lin_launcher.html">lin_launcher</a></code> to create a shortcut on Linux</p></div>
</div>
<div id="ref-examples">
<h2>Examples</h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span><span class="fu">radiant</span><span class="fu">::</span><span class="fu">launcher</span><span class="op">(</span><span class="st">"radiant.model"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-in"><span></span></span>
</code></pre></div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Create a launcher and updater for Linux (.sh) — lin_launcher • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Create a launcher and updater for Linux (.sh) — lin_launcher"><meta property="og:description" content="Create a launcher and updater for Linux (.sh)"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-reference-topic">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Create a launcher and updater for Linux (.sh)</h1>
<small class="dont-index">Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/R/radiant.R" class="external-link"><code>R/radiant.R</code></a></small>
<div class="hidden name"><code>lin_launcher.Rd</code></div>
</div>
<div class="ref-description">
<p>Create a launcher and updater for Linux (.sh)</p>
</div>
<div id="ref-usage">
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">lin_launcher</span><span class="op">(</span></span>
<span> app <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"radiant"</span>, <span class="st">"radiant.data"</span>, <span class="st">"radiant.design"</span>, <span class="st">"radiant.basics"</span>, <span class="st">"radiant.model"</span>,</span>
<span> <span class="st">"radiant.multivariate"</span><span class="op">)</span>,</span>
<span> port <span class="op">=</span> <span class="fl">4444</span>,</span>
<span> pdir <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/Sys.getenv.html" class="external-link">Sys.getenv</a></span><span class="op">(</span><span class="st">"HOME"</span><span class="op">)</span></span>
<span><span class="op">)</span></span></code></pre></div>
</div>
<div id="arguments">
<h2>Arguments</h2>
<dl><dt>app</dt>
<dd><p>App to run when the desktop icon is double-clicked ("radiant", "radiant.data", etc.). Default is "radiant"</p></dd>
<dt>port</dt>
<dd><p>Port to use for shiny::runApp (e.g, port = 4444)</p></dd>
<dt>pdir</dt>
<dd><p>Project directory to use. Default is Sys.getenv("HOME")</p></dd>
</dl></div>
<div id="details">
<h2>Details</h2>
<p>On Linux a file named 'radiant.sh' and one named 'update_radiant.sh' will be put on the desktop. Double-click the file to launch the specified Radiant app or update Radiant to the latest version</p>
</div>
<div id="ref-examples">
<h2>Examples</h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span><span class="fu">radiant</span><span class="fu">::</span><span class="fu">lin_launcher</span><span class="op">(</span><span class="st">"radiant"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-in"><span></span></span>
</code></pre></div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Create a launcher and updater for Mac (.command) — mac_launcher • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Create a launcher and updater for Mac (.command) — mac_launcher"><meta property="og:description" content="Create a launcher and updater for Mac (.command)"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-reference-topic">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Create a launcher and updater for Mac (.command)</h1>
<small class="dont-index">Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/R/radiant.R" class="external-link"><code>R/radiant.R</code></a></small>
<div class="hidden name"><code>mac_launcher.Rd</code></div>
</div>
<div class="ref-description">
<p>Create a launcher and updater for Mac (.command)</p>
</div>
<div id="ref-usage">
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">mac_launcher</span><span class="op">(</span></span>
<span> app <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"radiant"</span>, <span class="st">"radiant.data"</span>, <span class="st">"radiant.design"</span>, <span class="st">"radiant.basics"</span>, <span class="st">"radiant.model"</span>,</span>
<span> <span class="st">"radiant.multivariate"</span><span class="op">)</span>,</span>
<span> port <span class="op">=</span> <span class="fl">4444</span>,</span>
<span> pdir <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/Sys.getenv.html" class="external-link">Sys.getenv</a></span><span class="op">(</span><span class="st">"HOME"</span><span class="op">)</span></span>
<span><span class="op">)</span></span></code></pre></div>
</div>
<div id="arguments">
<h2>Arguments</h2>
<dl><dt>app</dt>
<dd><p>App to run when the desktop icon is double-clicked ("radiant", "radiant.data", etc.). Default is "radiant"</p></dd>
<dt>port</dt>
<dd><p>Port to use for shiny::runApp (e.g, port = 4444)</p></dd>
<dt>pdir</dt>
<dd><p>Project directory to use. Default is Sys.getenv("HOME")</p></dd>
</dl></div>
<div id="details">
<h2>Details</h2>
<p>On Mac a file named 'radiant.command' and one named 'update_radiant.command' will be put on the desktop. Double-click the file to launch the specified Radiant app or update Radiant to the latest version</p>
</div>
<div id="ref-examples">
<h2>Examples</h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span><span class="fu">radiant</span><span class="fu">::</span><span class="fu">mac_launcher</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-in"><span></span></span>
</code></pre></div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>radiant — radiant • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="radiant — radiant"><meta property="og:description" content="Launch radiant in the default web browser"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-reference-topic">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>radiant</h1>
<small class="dont-index">Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/R/aaa.R" class="external-link"><code>R/aaa.R</code></a>, <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/R/radiant.R" class="external-link"><code>R/radiant.R</code></a></small>
<div class="hidden name"><code>radiant.Rd</code></div>
</div>
<div class="ref-description">
<p>Launch radiant in the default web browser</p>
</div>
<div id="ref-usage">
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">radiant</span><span class="op">(</span><span class="va">state</span>, <span class="va">...</span><span class="op">)</span></span></code></pre></div>
</div>
<div id="arguments">
<h2>Arguments</h2>
<dl><dt>state</dt>
<dd><p>Path to state file to load</p></dd>
<dt>...</dt>
<dd><p>additional arguments to pass to shiny::runApp (e.g, port = 8080)</p></dd>
</dl></div>
<div id="details">
<h2>Details</h2>
<p>See <a href="https://radiant-rstats.github.io/docs/" class="external-link">https://radiant-rstats.github.io/docs/</a> for documentation and tutorials</p>
</div>
<div id="ref-examples">
<h2>Examples</h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span><span class="fu">radiant</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu">radiant</span><span class="op">(</span><span class="st">"https://github.com/radiant-rstats/docs/raw/gh-pages/examples/demo-dvd-rnd.state.rda"</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
</code></pre></div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Start radiant but do not open a browser — radiant_url • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Start radiant but do not open a browser — radiant_url"><meta property="og:description" content="Start radiant but do not open a browser"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-reference-topic">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Start radiant but do not open a browser</h1>
<small class="dont-index">Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/R/radiant.R" class="external-link"><code>R/radiant.R</code></a></small>
<div class="hidden name"><code>radiant_url.Rd</code></div>
</div>
<div class="ref-description">
<p>Start radiant but do not open a browser</p>
</div>
<div id="ref-usage">
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">radiant_url</span><span class="op">(</span><span class="va">state</span>, <span class="va">...</span><span class="op">)</span></span></code></pre></div>
</div>
<div id="arguments">
<h2>Arguments</h2>
<dl><dt>state</dt>
<dd><p>Path to statefile to load</p></dd>
<dt>...</dt>
<dd><p>additional arguments to pass to shiny::runApp (e.g, port = 8080)</p></dd>
</dl></div>
<div id="ref-examples">
<h2>Examples</h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span><span class="fu">radiant_url</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
</code></pre></div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Launch radiant in the Rstudio viewer — radiant_viewer • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Launch radiant in the Rstudio viewer — radiant_viewer"><meta property="og:description" content="Launch radiant in the Rstudio viewer"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-reference-topic">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Launch radiant in the Rstudio viewer</h1>
<small class="dont-index">Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/R/radiant.R" class="external-link"><code>R/radiant.R</code></a></small>
<div class="hidden name"><code>radiant_viewer.Rd</code></div>
</div>
<div class="ref-description">
<p>Launch radiant in the Rstudio viewer</p>
</div>
<div id="ref-usage">
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">radiant_viewer</span><span class="op">(</span><span class="va">state</span>, <span class="va">...</span><span class="op">)</span></span></code></pre></div>
</div>
<div id="arguments">
<h2>Arguments</h2>
<dl><dt>state</dt>
<dd><p>Path to state file to load</p></dd>
<dt>...</dt>
<dd><p>additional arguments to pass to shiny::runApp (e.g, port = 8080)</p></dd>
</dl></div>
<div id="details">
<h2>Details</h2>
<p>See <a href="https://radiant-rstats.github.io/docs/" class="external-link">https://radiant-rstats.github.io/docs/</a> for documentation and tutorials</p>
</div>
<div id="ref-examples">
<h2>Examples</h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span><span class="fu">radiant_viewer</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
</code></pre></div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Launch radiant in an Rstudio window — radiant_window • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Launch radiant in an Rstudio window — radiant_window"><meta property="og:description" content="Launch radiant in an Rstudio window"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-reference-topic">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Launch radiant in an Rstudio window</h1>
<small class="dont-index">Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/R/radiant.R" class="external-link"><code>R/radiant.R</code></a></small>
<div class="hidden name"><code>radiant_window.Rd</code></div>
</div>
<div class="ref-description">
<p>Launch radiant in an Rstudio window</p>
</div>
<div id="ref-usage">
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">radiant_window</span><span class="op">(</span><span class="va">state</span>, <span class="va">...</span><span class="op">)</span></span></code></pre></div>
</div>
<div id="arguments">
<h2>Arguments</h2>
<dl><dt>state</dt>
<dd><p>Path to state file to load</p></dd>
<dt>...</dt>
<dd><p>additional arguments to pass to shiny::runApp (e.g, port = 8080)</p></dd>
</dl></div>
<div id="details">
<h2>Details</h2>
<p>See <a href="https://radiant-rstats.github.io/docs/" class="external-link">https://radiant-rstats.github.io/docs/</a> for documentation and tutorials</p>
</div>
<div id="ref-examples">
<h2>Examples</h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span><span class="fu">radiant_window</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
</code></pre></div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Create a launcher and updater for Windows (.bat) — win_launcher • radiant</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Create a launcher and updater for Windows (.bat) — win_launcher"><meta property="og:description" content="Create a launcher and updater for Windows (.bat)"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body data-spy="scroll" data-target="#toc">
<div class="container template-reference-topic">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">radiant</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.6.0</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"><li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu"><li>
<a href="../articles/programming.html">Programming with Radiant</a>
</li>
</ul></li>
<li>
<a href="../news/index.html">Changelog</a>
</li>
</ul><ul class="nav navbar-nav navbar-right"><li>
<a href="https://github.com/radiant-rstats/radiant/" class="external-link">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul></div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header><div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Create a launcher and updater for Windows (.bat)</h1>
<small class="dont-index">Source: <a href="https://github.com/radiant-rstats/radiant/blob/HEAD/R/radiant.R" class="external-link"><code>R/radiant.R</code></a></small>
<div class="hidden name"><code>win_launcher.Rd</code></div>
</div>
<div class="ref-description">
<p>Create a launcher and updater for Windows (.bat)</p>
</div>
<div id="ref-usage">
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">win_launcher</span><span class="op">(</span></span>
<span> app <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"radiant"</span>, <span class="st">"radiant.data"</span>, <span class="st">"radiant.design"</span>, <span class="st">"radiant.basics"</span>, <span class="st">"radiant.model"</span>,</span>
<span> <span class="st">"radiant.multivariate"</span><span class="op">)</span>,</span>
<span> port <span class="op">=</span> <span class="fl">4444</span>,</span>
<span> pdir <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/Sys.getenv.html" class="external-link">Sys.getenv</a></span><span class="op">(</span><span class="st">"HOME"</span><span class="op">)</span></span>
<span><span class="op">)</span></span></code></pre></div>
</div>
<div id="arguments">
<h2>Arguments</h2>
<dl><dt>app</dt>
<dd><p>App to run when the desktop icon is double-clicked ("radiant", "radiant.data", etc.). Default is "radiant"</p></dd>
<dt>port</dt>
<dd><p>Port to use for shiny::runApp (e.g, port = 4444)</p></dd>
<dt>pdir</dt>
<dd><p>Project directory to use. Default is Sys.getenv("HOME")</p></dd>
</dl></div>
<div id="details">
<h2>Details</h2>
<p>On Windows a file named 'radiant.bat' and one named 'update_radiant.bat' will be put on the desktop. Double-click the file to launch the specified Radiant app or update Radiant to the latest version</p>
</div>
<div id="ref-examples">
<h2>Examples</h2>
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span><span class="fu">radiant</span><span class="fu">::</span><span class="fu">win_launcher</span><span class="op">(</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-in"><span></span></span>
</code></pre></div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
</nav></div>
</div>
<footer><div class="copyright">
<p></p><p>Developed by Vincent Nijs.</p>
</div>
<div class="pkgdown">
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer></div>
</body></html>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>/404.html</loc>
</url>
<url>
<loc>/LICENSE-text.html</loc>
</url>
<url>
<loc>/articles/index.html</loc>
</url>
<url>
<loc>/articles/programming.html</loc>
</url>
<url>
<loc>/authors.html</loc>
</url>
<url>
<loc>/index.html</loc>
</url>
<url>
<loc>/news/index.html</loc>
</url>
<url>
<loc>/reference/index.html</loc>
</url>
<url>
<loc>/reference/launcher.html</loc>
</url>
<url>
<loc>/reference/lin_launcher.html</loc>
</url>
<url>
<loc>/reference/mac_launcher.html</loc>
</url>
<url>
<loc>/reference/radiant.html</loc>
</url>
<url>
<loc>/reference/radiant_url.html</loc>
</url>
<url>
<loc>/reference/radiant_viewer.html</loc>
</url>
<url>
<loc>/reference/radiant_window.html</loc>
</url>
<url>
<loc>/reference/win_launcher.html</loc>
</url>
</urlset>
## install the latest version from github so it will be used on shinyapps.io
# packages <- paste0("radiant-rstats/", c(
# "radiant.data", "radiant.design", "radiant.basics",
# "radiant.model", "radiant.multivariate", "radiant"
# ))
#
# packages <- c(packages, "trestletech/shinyAce", "vnijs/DiagrammeR")
#
# ## Use the code below to install the development version
# if (!require(remotes)) {
# install.packages("remotes")
# }
# ret <- sapply(
# packages,
# function(p) {
# remotes::install_github(
# p,
# dependencies = FALSE,
# upgrade = "never"
# )
# }
# )
# install.packages(c("shinyFiles", "htmltools"), repo = "https://cloud.r-project.org/")
## to install the release version
# packages <- c(
# "radiant.data", "radiant.design", "radiant.basics",
# "radiant.model", "radiant.multivariate", "radiant",
# "shiny", "httpuv", "later", "rstudioapi"
# )
# packages <- c(
# "radiant.data", "radiant.design", "radiant.basics",
# "radiant.model", "radiant.multivariate", "radiant"
# )
# ret <- sapply(
# packages,
# install.packages,
# repos = c(
# "https://radiant-rstats.github.io/minicran/dev/",
# "https://radiant-rstats.github.io/minicran/"
# )
# )
## by listing the call to the radiant library it will get picked up as a dependency
# library(radiant)
# library(radiant.data)
# library(radiant.design)
# library(radiant.basics)
# library(radiant.model)
# library(radiant.multivariate)
# library(rstudioapi)
# library(shinyAce)
# library(shinyFiles)
# library(DT)
# library(htmltools)
library(shiny.i18n)
i18n <- Translator$new(translation_csvs_path = "../translations")
i18n$set_translation_language("zh")
## sourcing from radiant.data
options(radiant.path.data = system.file(package = "radiant.data"))
source(file.path(getOption("radiant.path.data"), "app/global.R"), encoding = getOption("radiant.encoding", default = "UTF-8"), local = TRUE)
if (getOption("radiant.development", default = TRUE)) {
ifelse(grepl("radiant", getwd()) && file.exists("../../inst"), "..", system.file(package = "radiant")) %>%
options(radiant.path = .)
}
options(radiant.path.design = system.file(package = "radiant.design"))
options(radiant.path.basics = system.file(package = "radiant.basics"))
options(radiant.path.model = system.file(package = "radiant.model"))
options(radiant.path.multivariate = system.file(package = "radiant.multivariate"))
# 添加quickgen模块路径
options(radiant.path.quickgen = system.file(package = "radiant.quickgen"))
# sourcing from radiant base, note that path is set in base/global.R
#source(file.path(getOption("radiant.path.data"), "app/global.R"), encoding = getOption("radiant.encoding", default = "UTF-8"), local = TRUE)
## setting path for figures in help files
addResourcePath("figures_design", file.path(getOption("radiant.path.design"), "app/tools/help/figures/"))
addResourcePath("figures_basics", file.path(getOption("radiant.path.basics"), "app/tools/help/figures/"))
addResourcePath("figures_model", file.path(getOption("radiant.path.model"), "app/tools/help/figures/"))
addResourcePath("figures_multivariate", file.path(getOption("radiant.path.multivariate"), "app/tools/help/figures/"))
# 添加quickgen模块的figures路径
addResourcePath("figures_quickgen", file.path(getOption("radiant.path.quickgen"), "app/tools/help/figures/"))
## setting path for www resources
addResourcePath("www_design", file.path(getOption("radiant.path.design"), "app/www/"))
addResourcePath("www_basics", file.path(getOption("radiant.path.basics"), "app/www/"))
addResourcePath("www_model", file.path(getOption("radiant.path.model"), "app/www/"))
addResourcePath("www_multivariate", file.path(getOption("radiant.path.multivariate"), "app/www/"))
# 添加quickgen模块的www路径
addResourcePath("www_quickgen", file.path(getOption("radiant.path.quickgen"), "app/www/"))
## loading url information
source(file.path(getOption("radiant.path.design"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
source(file.path(getOption("radiant.path.basics"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
source(file.path(getOption("radiant.path.model"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
source(file.path(getOption("radiant.path.multivariate"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
# 添加quickgen模块的init.R
source(file.path(getOption("radiant.path.quickgen"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
options(radiant.url.patterns = make_url_patterns())
if (!"package:radiant" %in% search() &&
isTRUE(getOption("radiant.development")) &&
getOption("radiant.path") == "..") {
options(radiant.from.package = FALSE)
} else {
options(radiant.from.package = TRUE)
}
## to use an alternative set of .rda files with data.frames as the default adapt and
## un-comment the line below
## note that "data/" here points to inst/app/data in the radiant directory but can
## be any (full) path on a server
# options(radiant.init.data = list.files(path = "data/", full.names = TRUE))
i18n <- get("i18n", envir = .GlobalEnv)
if (isTRUE(getOption("radiant.from.package"))) {
library(radiant)
}
shinyServer(function(input, output, session) {
summary.correlation <- radiant.basics:::summary.correlation
enc <- getOption("radiant.encoding")
## source shared functions
source(file.path(getOption("radiant.path.data"), "app/init.R"), encoding = enc, local = TRUE)
source(file.path(getOption("radiant.path.data"), "app/radiant.R"), encoding = enc, local = TRUE)
## source data & app tools from radiant.data
for (file in list.files(
c(
file.path(getOption("radiant.path.data"), "app/tools/app"),
file.path(getOption("radiant.path.data"), "app/tools/data")
),
pattern = "\\.(r|R)$",
full.names = TRUE)) {
source(file, encoding = enc, local = TRUE)
}
## list of radiant menu's to include - 添加 radiant.quickgen
rmenus <- c("radiant.data", "radiant.quickgen", "radiant.design", "radiant.basics", "radiant.model", "radiant.multivariate")
## packages to use for example data
options(radiant.example.data = rmenus)
for (i in rmenus[-1]) {
## 'sourcing' radiant's package functions in the server.R environment
if (!isTRUE(getOption("radiant.from.package"))) {
eval(parse(text = paste0("radiant.data::copy_all(", i, ")")))
cat(paste0("\nGetting ", i, " from source ...\n"))
}
## help ui
ipath <- paste0(strsplit(i, "\\.")[[1]], collapse = ".path.")
source(file.path(getOption(ipath), "app/help.R"), encoding = enc, local = TRUE)
## source analysis tools for each app
for (file in list.files(file.path(getOption(ipath), "app/tools/analysis"), pattern = "\\.(r|R)$", full.names = TRUE))
source(file, encoding = enc, local = TRUE)
}
## ui creation functions
source(file.path(getOption("radiant.path.model"), "app/radiant.R"), encoding = enc, local = TRUE)
## help ui
output$help_ui <- renderUI({
sidebarLayout(
sidebarPanel(
help_data_panel,
help_quickgen_panel, # 添加 quickgen 的 help 面板
help_design_panel,
help_basics_panel,
help_model_panel,
help_multivariate_panel,
uiOutput("help_text"),
width = 3
),
mainPanel(
HTML(paste0("<h2>Select help files to show and search</h2><hr>")),
htmlOutput("help_data"),
htmlOutput("help_quickgen"), # 添加 quickgen 的 help 输出
htmlOutput("help_design"),
htmlOutput("help_basics"),
htmlOutput("help_model"),
htmlOutput("help_multivariate")
)
)
})
## save state on refresh or browser close
saveStateOnRefresh(session)
})
app <- ShinyDriver$new("../")
app$snapshotInit("mytest")
app$uploadFile(uploadfile = "bbb.rds") # <-- This should be the path to the file, relative to the app's tests/ directory
app$setInputs(tabs_data = "Pivot")
app$setInputs(pvt_cvars = "gender")
app$setInputs(pvt_normalize = "total")
app$setInputs(pvt_perc = TRUE)
app$setInputs(pvt_run = "click")
# Input 'pivotr_rows_current' was set, but doesn't have an input binding.
# Input 'pivotr_rows_all' was set, but doesn't have an input binding.
app$snapshot()
app$setInputs(pvt_cvars = character(0))
app$setInputs(pvt_cvars = "state")
app$setInputs(pvt_perc = FALSE)
# Input 'pivotr_rows_current' was set, but doesn't have an input binding.
# Input 'pivotr_rows_all' was set, but doesn't have an input binding.
# Input 'pivotr_rows_current' was set, but doesn't have an input binding.
# Input 'pivotr_rows_all' was set, but doesn't have an input binding.
# Input 'pivotr_rows_current' was set, but doesn't have an input binding.
# Input 'pivotr_rows_all' was set, but doesn't have an input binding.
app$setInputs(pvt_normalize = "None")
# Input 'pivotr_rows_current' was set, but doesn't have an input binding.
# Input 'pivotr_rows_all' was set, but doesn't have an input binding.
# Input 'pivotr_rows_current' was set, but doesn't have an input binding.
# Input 'pivotr_rows_all' was set, but doesn't have an input binding.
# Input 'pivotr_rows_current' was set, but doesn't have an input binding.
# Input 'pivotr_rows_all' was set, but doesn't have an input binding.
# Input 'pivotr_search_columns' was set, but doesn't have an input binding.
app$snapshot()
## ui for radiant
navbar_proj(
suppressWarnings(
do.call(
navbarPage,
c(
i18n$t("Radiant for R"),
getOption("radiant.nav_ui"),
getOption("radiant.quickgen_ui"),
getOption("radiant.design_ui"),
getOption("radiant.basics_ui"),
getOption("radiant.model_ui"),
getOption("radiant.multivariate_ui"),
getOption("radiant.shared_ui"),
help_menu("help_ui")
)
)
)
)
Name: Start radiant (browser)
Description: Start radiant in the default browser
Binding: radiant
Interactive: true
en,zh,source
Help,帮助,"global.R, radiant.R, manage_ui.R, pivotr_ui.R"
Normal,正态分布,"clt_ui.R,simulater_ui.R"
Binomial,二项分布,"clt_ui.R,simulater_ui.R"
Uniform,均匀分布,"clt_ui.R,simulater_ui.R"
Exponential,指数分布,clt_ui.R
Sum,求和,clt_ui.R
Mean,平均值,"clt_ui.R,sample_size_comp.R, sample_size_ui.R"
Run simulation,运行模拟,"clt_ui.R,simulater_ui.R"
Re-run simulation,重新运行模拟,"clt_ui.R,simulater_ui.R"
Distribution:,分布:,clt_ui.R
Min:,最小值:,"clt_ui.R,dtree_ui.R"
Max:,最大值:,"clt_ui.R,dtree_ui.R"
Mean:,均值:,"clt_ui.R,simulater_ui.R"
SD:,标准差:,clt_ui.R
Rate:,速率:,clt_ui.R
Size:,样本量:,"clt_ui.R,transform_ui.R, visualize_ui.R,nn_ui.R"
Prob:,概率:,clt_ui.R
Sample size:,样本大小:,"clt_ui.R,sampling_ui.R"
# of samples:,样本数量:,clt_ui.R
Number of bins:,分箱数量:,"clt_ui.R,visualize_ui.R"
Central Limit Theorem,中心极限定理,"clt_ui.R,init.R"
Basics > Probability,基础 > 概率,clt_ui.R
Please choose a sample size larger than 2,请选择一个大于 2 的样本大小,clt_ui.R
Please choose 2 or more samples,请选择 2 个或更多样本,clt_ui.R
Please choose a minimum value for the uniform distribution,请为均匀分布选择一个最小值,clt_ui.R
Please choose a maximum value for the uniform distribution,请为均匀分布选择一个最大值,clt_ui.R
The maximum value for the uniform distribution\nmust be larger than the minimum value,均匀分布的最大值必须大于最小值,clt_ui.R
Please choose a mean value for the normal distribution,请为正态分布选择一个均值,clt_ui.R
Please choose a non-zero standard deviation for the normal distribution,请为正态分布选择一个非零的标准差,clt_ui.R
Please choose a rate larger than 1 for the exponential distribution,请为指数分布选择一个大于 1 的速率,clt_ui.R
Please choose a size parameter larger than 1 for the binomial distribution,请为二项分布选择一个大于 1 的大小参数,clt_ui.R
Please choose a probability between 0 and 1 for the binomial distribution,请为二项分布选择一个介于 0 到 1 之间的概率,clt_ui.R
** Press the Run simulation button to simulate data **,** 请点击“运行模拟”按钮以生成数据 **,"clt_ui.R,simulater_ui.R"
Generating plots,正在生成图形,"clt_ui.R, compare_means_ui.R,crs_ui.R, crtree_ui.R, gbt_ui.R, logistic_ui.R,conjoint_ui.R, kclus_ui.R"
Save central limit theorem plot,保存中心极限定理图,clt_ui.R
Two sided,双尾检验,"compare_means_ui.R,sample_size_comp.R"
Less than,小于,compare_means_ui.R
Greater than,大于,compare_means_ui.R
independent,独立样本,compare_means_ui.R
paired,配对样本,compare_means_ui.R
None,无,"compare_means_ui.R,pivotr_ui.R,crtree_ui.R, gbt_ui.R,conjoint_ui.R"
Bonferroni,Bonferroni 校正,compare_means_ui.R
Scatter,散点图,"compare_means_ui.R,visualize_ui.R,logistic_ui.R,kclus_ui.R"
Box,箱线图,compare_means_ui.R
Density,密度图,"compare_means_ui.R,visualize_ui.R,kclus_ui.R"
Bar,条形图,"compare_means_ui.R,visualize_ui.R,kclus_ui.R"
Select a factor or numeric variable:,选择一个因子或数值变量:,compare_means_ui.R
Numeric variable(s):,数值变量(多选):,"compare_means_ui.R,explore_ui.R"
Numeric variable:,数值变量:,"compare_means_ui.R,pivotr_ui.R"
Choose combinations:,选择组合:,compare_means_ui.R
Evaluate all combinations,评估所有组合,compare_means_ui.R
Alternative hypothesis:,备择假设:,"compare_means_ui.R,sample_size_comp.R"
Confidence level:,置信水平:,"compare_means_ui.R,sample_size_comp.R, sample_size_ui.R,logistic_ui.R"
Show additional statistics,显示额外统计量,compare_means_ui.R
Sample type:,样本类型:,compare_means_ui.R
Multiple comp. adjustment:,多重比较校正:,compare_means_ui.R
Test type:,检验类型:,compare_means_ui.R
t-test,t 检验,compare_means_ui.R
Wilcox,Wilcoxon 检验,compare_means_ui.R
Select plots:,选择绘图类型:,compare_means_ui.R
Select plots,选择绘图,compare_means_ui.R
Compare means,均值比较,"compare_means_ui.R,init.R"
Summary,摘要,"compare_means_ui.R,doe_ui.R, randomizer_ui.R, sample_size_comp.R, sample_size_ui.R, sampling_ui.R,gbt_ui.R,conjoint_ui.R"
Plot,图形,"compare_means_ui.R,sample_size_comp.R,dtree_ui.R, gbt_ui.R,conjoint_ui.R"
Basics > Means,基础 > 均值,compare_means_ui.R
"This analysis requires at least two variables. The first can be of type
factor, numeric, or interval. The second must be of type numeric or interval.
If these variable types are not available please select another dataset.
","该分析至少需要两个变量。第一个变量可以是因子、数值或区间类型,第二个变量必须是数值或区间类型。如果这些类型的变量不可用,请选择其他数据集。
",compare_means_ui.R
Nothing to plot. Please select a plot type,没有可绘制的内容,请选择绘图类型,compare_means_ui.R
Save compare means plot,保存均值比较图,compare_means_ui.R
Basics > Proportions,基础 > 比例,compare_props_ui.R
Compare proportions,比较比例,"compare_props_ui.R,init.R"
"This analysis requires two categorical variables. The first must have
two or more levels. The second can have only two levels. If these
variable types are not available please select another dataset.
","该分析需要两个分类变量。第一个变量必须具有两个或更多水平,第二个变量只能有两个水平。如果这些变量类型不可用,请选择其他数据集。
",compare_props_ui.R
Select a grouping variable:,选择分组变量:,compare_props_ui.R
Save compare proportions plot,保存比较比例图,compare_props_ui.R
Dodge,并列柱状图,compare_props_ui.R
Variable (select one):,变量(选择一个):,compare_props_ui.R
Pearson,皮尔逊积矩相关,correlation_ui.R
Spearman,斯皮尔曼秩相关,correlation_ui.R
Kendall,肯德尔秩相关,correlation_ui.R
Calculate correlation,计算相关性,correlation_ui.R
Basics > Tables,基础 > 表格,correlation_ui.R
Correlation,相关性,"correlation_ui.R,init.R"
Adjust for {factor} variables,针对 {factor} 变量进行调整,"correlation_ui.R,full_factor_ui.R"
Calculate adjusted p.values,计算调整后的 p 值,correlation_ui.R
Correlation cutoff:,相关性阈值:,correlation_ui.R
Show covariance matrix,显示协方差矩阵,correlation_ui.R
Store,存储,"correlation_ui.R,explore_ui.R, pivotr_ui.R, view_ui.R,randomizer_ui.R, sampling_ui.R,crs_ui.R, gbt_ui.R, logistic_ui.R,conjoint_ui.R"
"This analysis requires two or more variables or type numeric, integer,or date. If these variable types are not available please select another dataset.",该分析需要两个或以上的数值型、整数型或日期型变量。如果这些变量类型不可用,请选择其他数据集。,correlation_ui.R
Method:,方法:,"correlation_ui.R,full_factor_ui.R"
Acquiring variable information,正在获取变量信息,"correlation_ui.R,pivotr_ui.R,crtree_ui.R, evalbin_ui.R, evalreg_ui.R, gbt_ui.R, logistic_ui.R"
Select variables:,选择变量:,"correlation_ui.R,transform_ui.R"
Store as data.frame:,存储为数据框:,correlation_ui.R
"This analysis requires two or more variables or type numeric,\ninteger,or date. If these variable types are not available\nplease select another dataset.\n\n",本分析需要两个或以上的变量,并且类型必须是数值型、整数型或日期型。如果这些变量类型不可用,请选择其他数据集。,correlation_ui.R
Save correlation plot,保存相关性图表,correlation_ui.R
Number of data points plotted:,绘制的数据点数量:,"correlation_ui.R,visualize_ui.R,crtree_ui.R, gbt_ui.R, logistic_ui.R"
"This analysis requires two or more variables or type numeric,
integer,or date. If these variable types are not available
please select another dataset.
","本分析需要两个或以上的变量,并且类型必须是数值型、整数型或日期型。
如果这些变量类型不可用,请选择其他数据集。
",correlation_ui.R
Re-calculate correlations,重新计算相关系数,correlation_ui.R
Observed,观察值,cross_tabs_ui.R
Expected,期望值,cross_tabs_ui.R
Chi-squared,卡方值,cross_tabs_ui.R
Deviation std.,标准差偏差,cross_tabs_ui.R
Row percentages,行百分比,cross_tabs_ui.R
Column percentages,列百分比,cross_tabs_ui.R
Table percentages,表格百分比,cross_tabs_ui.R
Cross-tabs,交叉表,"cross_tabs_ui.R,init.R"
"This analysis requires two categorical variables. Both must have two or more levels.
If these variable types are not available please select another dataset.
","此分析需要两个分类变量,且每个变量必须至少有两个水平。如果这些类型的变量不可用,请选择其他数据集。
",cross_tabs_ui.R
Select a categorical variable:,请选择一个分类变量:,cross_tabs_ui.R
Save cross-tabs plot,保存交叉表图形,cross_tabs_ui.R
Goodness of fit,拟合优度检验,"goodness_ui.R,init.R"
"This analysis requires a categorical variables with two or more levels.
If such a variable type is not available please select another dataset.
","此分析需要一个具有两个或以上水平的分类变量。如果没有这种类型的变量,请选择其他数据集。
",goodness_ui.R
Save goodness of fit plot,保存拟合优度检验图形,goodness_ui.R
Probabilities:,概率:,"goodness_ui.R,randomizer_ui.R"
"Enter probabilities (e.g., 1/2 1/2)",输入概率(例如:1/2 1/2),"goodness_ui.R,randomizer_ui.R"
Discrete,离散分布,"prob_calc_ui.R,simulater_ui.R"
F,F 分布,prob_calc_ui.R
Log normal,对数正态分布,"prob_calc_ui.R,simulater_ui.R"
Poisson,泊松分布,"prob_calc_ui.R,simulater_ui.R"
Values,数值,prob_calc_ui.R
Probability calculator,概率计算器,"prob_calc_ui.R,init.R"
Input type:,输入类型:,prob_calc_ui.R
Decimals:,小数位数:,"prob_calc_ui.R,explore_ui.R, pivotr_ui.R, view_ui.R,simulater_ui.R"
Save probability calculator plot,保存概率计算器图形,prob_calc_ui.R
Please provide a mean and standard deviation (> 0),请提供平均值和标准差(标准差需大于 0),prob_calc_ui.R
St. dev:,标准差:,prob_calc_ui.R
Lower bound:,下限:,prob_calc_ui.R
Upper bound:,上限:,prob_calc_ui.R
Provide an integer value for the number of decimal places,请输入整数,表示保留的小数位数,prob_calc_ui.R
"Please provide a set of values and probabilities.
Separate numbers using spaces (e.g., 1/2 1/2)",请提供一组数值和对应的概率。\n请用空格分隔(例如:1/2 1/2),prob_calc_ui.R
Values:,数值:,"prob_calc_ui.R,simulater_ui.R"
Please provide a value for n (number of trials) and p (probability of success),请提供试验次数 (n) 和成功概率 (p) 的值,prob_calc_ui.R
Please provide a minimum and a maximum value,请提供最小值和最大值,prob_calc_ui.R
Please provide a value for the degrees of freedom (> 0),请提供大于 0 的自由度值,prob_calc_ui.R
"Please provide a value for Degrees of freedom 1 (> 0)
and for Degrees of freedom 2 (> 4)",请提供自由度 1(大于 0)和自由度 2(大于 4)的值,prob_calc_ui.R
Please provide a value for the rate (> 0),请提供大于 0 的速率值,prob_calc_ui.R
Please provide a value for lambda (> 0),请提供大于 0 的 λ(Lambda)值,prob_calc_ui.R
n:,试验次数:,"prob_calc_ui.R,simulater_ui.R"
p:,成功概率:,"prob_calc_ui.R,simulater_ui.R"
Degrees of freedom:,自由度:,prob_calc_ui.R
Degrees of freedom 1:,自由度 1:,prob_calc_ui.R
Degrees of freedom 2:,自由度 2:,prob_calc_ui.R
Mean log:,对数均值:,prob_calc_ui.R
St. dev log:,对数标准差:,prob_calc_ui.R
Lambda:,λ:,"prob_calc_ui.R,kclus_ui.R,simulater_ui.R"
Histogram,直方图,single_mean_ui.R
Simulate,模拟,"single_mean_ui.R,simulater_ui.R,init.R"
Single mean,单样本均值,"single_mean_ui.R,init.R"
Comparison value:,比较值:,single_mean_ui.R
"This analysis requires a variable of type numeric or interval. If none are
available please select another dataset.
","此分析需要一个数值型或区间型变量。如果当前数据集中没有此类变量,请选择其他数据集。
",single_mean_ui.R
Save single mean plot,保存单样本均值图表,single_mean_ui.R
Single proportion,单样本比例,"single_prop_ui.R,init.R"
Binomial exact,精确二项检验,single_prop_ui.R
Z-test,Z 检验,single_prop_ui.R
Choose level:,选择水平:,"single_prop_ui.R,crtree_ui.R, evalbin_ui.R, logistic_ui.R"
"This analysis requires a categorical variable. In none are available
please select another dataset.
","本分析需要一个分类变量。如果没有可用的分类变量,请选择其他数据集。
",single_prop_ui.R
Save single proportion plot,保存单样本比例图,single_prop_ui.R
Keyboard shortcuts,键盘快捷键,"global.R, manage_ui.R,help.R"
Combine with:,合并对象:,combine_ui.R
Join by:,按以下字段连接:,combine_ui.R
Variables to add:,要追加的变量:,combine_ui.R
Inner join,内连接,combine_ui.R
Left join,左连接,combine_ui.R
Right join,右连接,combine_ui.R
Full join,全连接,combine_ui.R
Semi join,半连接,combine_ui.R
Anti join,反连接,combine_ui.R
Bind rows,按行合并,combine_ui.R
Bind columns,按列合并,combine_ui.R
Intersect,交集,combine_ui.R
Union,并集,combine_ui.R
Set difference,差集,combine_ui.R
Combine,合并,"combine_ui.R, data_ui.R"
Only one dataset available.,仅有一个数据集,无法合并。,combine_ui.R
Combine type:,合并方式:,combine_ui.R
Combined dataset:,合并后数据集:,combine_ui.R
<label>Only one dataset available.</label>,<label>仅有一个数据集,无法合并。</label>,combine_ui.R
<h3>Dataset 1:,<h3>数据集 1:,combine_ui.R
<h3>Dataset 2:,<h3>数据集 2:,combine_ui.R
<h3>No matching variables selected</h3>,<h3>未选择可匹配字段</h3>,combine_ui.R
"</br><h4>Combining data failed. The error message was:</br></br>\"",</br><h4>合并数据失败,错误信息如下:</br></br>\""""",combine_ui.R,
<h3>Combined dataset: ,<h3>合并后数据集:,combine_ui.R
Filter data,筛选数据,data_ui
Data filter:,数据筛选:,data_ui
"Provide a filter (e.g., price > 5000) and press return",输入筛选条件(例如 price > 5000)并按回车,data_ui
Data arrange (sort):,数据排序:,data_ui
"Arrange (e.g., color, desc(price)) and press return","输入排序方式(例如 color, desc(price))并按回车",data_ui
Data slice (rows):,数据行截取:,data_ui
Manage,管理,data_ui
Data preview,数据预览,data_ui
Data structure,数据结构,data_ui
Data summary,数据摘要,data_ui
Data load and save commands,数据加载与保存命令,data_ui
View,查看,"data_ui, view_ui.R"
Visualize,可视化,"data_ui, visualize_ui.R"
Pivot,透视表,data_ui
Explore,探索,"data_ui, explore_ui.R"
Transform,转换,data_ui
Group by:,分组变量:,"explore_ui.R, pivotr_ui.R,simulater_ui.R"
Select group-by variable,选择分组变量,"explore_ui.R,simulater_ui.R"
Apply function(s):,应用函数:,explore_ui.R
Select functions,选择函数,explore_ui.R
Function,函数,"explore_ui.R,help.R"
Variables,变量,explore_ui.R
Group by,分组,explore_ui.R
Column header:,列标题:,explore_ui.R
Store as:,存储为:,"explore_ui.R, pivotr_ui.R,randomizer_ui.R, sampling_ui.R"
Provide a table name,请输入表格名称,"explore_ui.R, pivotr_ui.R,evalbin_ui.R"
Create table,生成表格,explore_ui.R
Update table,更新表格,explore_ui.R
Table slice (rows):,表格行选择:,"explore_ui.R, pivotr_ui.R, view_ui.R"
"e.g., 1:50 and press return",例如 1:5 并按回车,"explore_ui.R, data_ui"
Generating explore table,正在生成探索表格,explore_ui.R
Data Stored,数据已保存,"explore_ui.R, pivotr_ui.R, view_ui.R,randomizer_ui.R, sampling_ui.R,crs_ui.R"
Dataset was successfully added to the datasets dropdown. Add code to Report > Rmd or Report > R to (re)create the results by clicking the report icon on the bottom left of your screen.,数据集已成功添加到下拉菜单中。点击左下角的报告图标,在 报告 > Rmd 或 报告 > R 中添加代码以(重新)生成结果。,explore_ui.R
OK,确定,"explore_ui.R, manage_ui.R, pivotr_ui.R,randomizer_ui.R, sampling_ui.R,crs_ui.R, evalbin_ui.R"
Load radiant state file,加载 Radiant 状态文件,"manage_ui.R,global.R"
Load,加载,manage_ui.R
Load data,加载数据,manage_ui.R
Description,描述,manage_ui.R
Paste,粘贴,manage_ui.R
Copy data,复制数据,manage_ui.R
Save,保存,"manage_ui.R,logistic_ui.R,radiant.R"
Save data,保存数据,manage_ui.R
Save radiant state file,保存 Radiant 状态文件,"manage_ui.R,global.R"
Add/edit data description,添加/编辑数据描述,manage_ui.R
Rename data,重命名数据,manage_ui.R
Display:,显示:,manage_ui.R
Show R-code,显示 R 代码,manage_ui.R
Remove data from memory,从内存中移除数据,manage_ui.R
Remove data,移除数据,manage_ui.R
Copy-and-paste data below:,复制并粘贴数据到下方:,manage_ui.R
Data.frames in Global Env:,全局环境中的数据框:,manage_ui.R
to global workspace,到全局工作空间,manage_ui.R
rds | rda | rdata,rds | rda | rdata,manage_ui.R
parquet,列式存储,manage_ui.R
csv,csv,manage_ui.R
clipboard,剪贴板,transform_ui.R
Clipboard,剪贴板,"manage_ui.R,transform_ui.R"
examples,示例,manage_ui.R
rds (url),rds(url),manage_ui.R
csv (url),csv(url),manage_ui.R
from global workspace,从全局工作空间,manage_ui.R
radiant state file,Radiant 状态文件,manage_ui.R
rds,rds,manage_ui.R
rda,rda,manage_ui.R
<label>Load radiant state file:</label></br>, "<label>加载 Radiant 状态文件:</label></br>", "manage_ui.R"
Upload radiant state file:, "上传 Radiant 状态文件:", "manage_ui.R"
, "", "manage_ui.R"
Datasets:, "数据集:", "manage_ui.R"
Update description, "更新描述", "manage_ui.R"
Load data of type:, "加载数据类型:", "data_ui"
Header, "表头", "data_ui"
Str. as Factor, "作为因子处理字符串", "data_ui"
Separator:, "分隔符:", "data_ui"
Decimal:, "小数点:", "data_ui"
Maximum rows to read:, "最大读取行数:", "data_ui"
Save data to type:, "保存数据类型:", "manage_ui.R"
<label>Save radiant state file:</label><br/>, "<label>保存 Radiant 状态文件:</label><br/>", "manage_ui.R"
## Load commands, "## 加载命令", "manage_ui.R"
diamonds, "钻石数据集", "manage_ui.R"
<label>Add data description:</label><br>, "<label>添加数据描述:</label><br>", "manage_ui.R"
Type text to describe the data using markdown to format it.\nSee http://commonmark.org/help/ for more information, "使用 Markdown 格式化文本来描述数据。更多信息请参见 http://commonmark.org/help/", "manage_ui.R"
preview,预览,manage_ui.R
str,结构,manage_ui.R
summary,总结,manage_ui.R
#### There was an error loading the data. Please make sure the data are in csv format,#### 加载数据时发生错误。请确保数据为 CSV 格式。,manage.R
Read issues (max 10 rows shown):,读取问题(最多显示 10 行):,manage.R
#### Radiant does not load xls files directly. Please save the data as a csv file and try again.,#### Radiant 不支持直接加载 XLS 文件。请将数据另存为 CSV 文件后再试。,manage.R
#### The filename extension \{fext}\" does not match the specified file-type \"{ext}\". Please specify the file type you are trying to upload",#### 文件扩展名“{fext}”与所选的文件类型“{ext}”不匹配。请确认要上传的文件类型。,manage.R
#### There was an error loading the data. Please make sure the data are in rda format.,#### 加载数据时发生错误。请确保数据为 RDA 格式。,manage.R
#### To restore state select 'radiant state file' from the 'Load data of type' drowdown before loading the file,#### 如需恢复状态,请先在“数据类型”下拉菜单中选择“Radiant 状态文件”后再加载。,manage.R
#### More than one R object contained in the data.,#### 数据中包含多个 R 对象。,manage.R
#### There was an error loading the data. Please make sure the data are in rds format.,#### 加载数据时发生错误。请确保数据为 RDS 格式。,manage.R
The 'arrow' package is not installed. Please install it and try again.,未安装 'arrow' 包。请先安装后再试。,manage.R
#### The arrow package required to work with data in parquet format is not installed. Please use install.packages('arrow'),#### 加载 Parquet 格式数据需要安装 arrow 包。请运行 install.packages('arrow') 进行安装。,manage.R
#### There was an error loading the data. Please make sure the data are in parquet format.,#### 加载数据时发生错误。请确保数据为 Parquet 格式。,manage.R
#### There was an error loading the data,#### 加载数据时发生错误,manage.R
#### The selected filetype is not currently supported ({fext}),#### 当前不支持所选文件类型({fext}),manage.R
Row,行,pivotr_ui.R
Column,列,pivotr_ui.R
Total,总计,pivotr_ui.R
Color bar,色条,pivotr_ui.R
Heat map,热力图,pivotr_ui.R
Categorical variables:,分类变量:,pivotr_ui.R
Select categorical variables,选择分类变量,pivotr_ui.R
Select numeric variable,选择数值变量,pivotr_ui.R
Apply function:,应用函数:,"pivotr_ui.R,simulater_ui.R"
Normalize by:,归一化方式:,pivotr_ui.R
Conditional formatting:,条件格式化:,pivotr_ui.R
Create pivot table,生成透视表,pivotr_ui.R
Update pivot table,更新透视表,pivotr_ui.R
"e.g., 1:5 and press return",例如:1:5 并按回车,pivotr_ui.R
Show table ,显示表格,pivotr_ui.R
Show plot ,显示图形,pivotr_ui.R
Percentage,百分比,pivotr_ui.R
Chi-square,卡方检验,pivotr_ui.R
Fill,填充,pivotr_ui.R
Flip,翻转,"pivotr_ui.R,visualize_ui.R"
Pivotr,透视表模块,pivotr_ui.R
Generating pivot table,正在生成透视表,pivotr_ui.R
Plots created for at most 3 categorical variables,最多只能为三个分类变量生成图表,pivotr_ui.R
Dataset '%s' was successfully added to the datasets dropdown. Add code to Report > Rmd or Report > R to (re)create the results by clicking the report icon on the bottom left of your screen.,数据集「%s」已成功添加至下拉菜单。点击左下角的报告图标可将代码添加到 Report > Rmd 或 Report > R,以用于(重新)生成结果。,"pivotr_ui.R,randomizer_ui.R, sampling_ui.R"
Making plot,正在生成图表,"pivotr_ui.R,dtree_ui.R"
Save pivot plot,保存透视图,pivotr_ui.R
Plot type:,图类型:,pivotr_ui.R
Select variable(s):,选择变量:,transform_ui.R
Normalizing variable:,标准化变量:,transform_ui.R
Frequency variable:,频率变量:,transform_ui.R
Key name:,键名:,transform_ui.R
Value name:,值名:,transform_ui.R
Key(s):,键(s):,transform_ui.R
Value:,值:,"transform_ui.R,simulater_ui.R"
Fill:,填充:,"transform_ui.R, visualize_ui.R"
Reorder/remove variables:,重新排序/移除变量:,transform_ui.R
Select a single variable of type factor or character,选择一个类型为因子或字符的单个变量,transform_ui.R
Reorder/remove levels:,重新排序/移除级别:,transform_ui.R
Replacement level name:,替换级别名称,transform_ui.R
Variable name extension:,变量名扩展:,transform_ui.R
Recoded variable name:,重新编码变量名:,transform_ui.R
Variable name:,变量名:,"transform_ui.R,doe_ui.R"
Add extension to variable name,为变量名添加扩展,transform_ui.R
Rename variable(s):,重命名变量:,transform_ui.R
Create:,创建:,transform_ui.R
Nr bins:,箱数:,transform_ui.R
Reverse order,反转顺序,transform_ui.R
Seed:,种子:,"transform_ui.R,crtree_ui.R, gbt_ui.R"
Reverse filter and slice,反向过滤并切片,transform_ui.R
Paste from spreadsheet:,从电子表格粘贴:,transform_ui.R
"Specify a recode statement, assign a name to the recoded variable, and press 'return'",指定重新编码语句,为重新编码的变量分配名称,并按回车,transform_ui.R
Select one or more variables to rename,选择一个或多个变量进行重命名,transform_ui.R
Select one or more variables to replace,选择一个或多个变量进行替换,transform_ui.R
Select a variable to recode,选择一个变量进行重新编码,transform_ui.R
Select one or more variables to bin,选择一个或多个变量进行分箱,transform_ui.R
Select a single variable of type factor to change the ordering and/or number of levels,选择一个因子类型的单个变量来更改排序和/或级别数量,transform_ui.R
Select one or more variables to normalize,选择一个或多个变量进行标准化,transform_ui.R
Select one or more variables to see the effects of removing missing values,选择一个或多个变量,查看移除缺失值的效果,transform_ui.R
Select one or more variables to see the effects of removing duplicates,选择一个或多个变量,查看移除重复值的效果,transform_ui.R
Select one or more variables to gather,选择一个或多个变量进行汇集,transform_ui.R
Select one or more variables to expand,选择一个或多个变量进行扩展,transform_ui.R
Select a transformation type or select variables to summarize,选择一个转换类型或选择变量进行汇总,transform_ui.R
The transformation type you selected generated an error.,您选择的转换类型生成了一个错误。,transform_ui.R
The error message was:,错误消息是:,transform_ui.R
Please change the selection of variables or the transformation type and try again.,请更改变量选择或转换类型并重试。,transform_ui.R
The create command was not valid.,创建命令无效。,transform_ui.R
The command entered was:,输入的命令是:,transform_ui.R
Please try again. Examples are shown in the help file (click the ? icon).,请再试一次。示例已显示在帮助文件中(点击?图标),transform_ui.R
Some of the variables names used are not valid. Please use 'Rename' to ensure variable names do not have any spaces or symbols and start with a letter,使用的变量名中有些无效。请使用“重命名”确保变量名没有空格或符号,并以字母开头,transform_ui.R
No duplicates found (n_distinct = ,未找到重复项(n_distinct = ,transform_ui.R
## remove missing values,## 移除缺失值,transform_ui.R
## remove duplicate rows,## 移除重复行,transform_ui.R
## show duplicate rows,## 显示重复行,transform_ui.R
## change variable type,## 更改变量类型,transform_ui.R
## transform variable,## 转换变量,transform_ui.R
## created variable to select training sample,## 创建变量来选择训练样本,transform_ui.R
## create new variable,## 创建新变量,transform_ui.R
## rename variable,## 重命名变量,transform_ui.R
## reorder/remove variables,## 重新排序/移除变量,transform_ui.R
## change factor levels,## 更改因子级别,transform_ui.R
## bin variables,## 分箱变量,transform_ui.R
## gather columns,## 汇集列,transform_ui.R
## spread columns,## 扩展列,transform_ui.R
## create holdout sample,## 创建保留样本,transform_ui.R
## register the new dataset,## 注册新数据集,transform_ui.R
Ln (natural log),自然对数,transform_ui.R
Square,平方,transform_ui.R
Square‑root,平方根,transform_ui.R
Center,居中,"transform_ui.R,logistic_ui.R"
Standardize,标准化,"transform_ui.R,logistic_ui.R,hclus_ui.R"
Inverse,逆,transform_ui.R
As factor,作为因子,transform_ui.R
As numeric,作为数值,transform_ui.R
As integer,作为整数,transform_ui.R
As character,作为字符,transform_ui.R
As time series,作为时间序列,transform_ui.R
As date (mdy),作为日期(mdy),transform_ui.R
As date (dmy),作为日期(dmy),transform_ui.R
As date (ymd),作为日期(ymd),transform_ui.R
As date/time (mdy_hms),作为日期时间(mdy_hms),transform_ui.R
As date/time (mdy_hm),作为日期时间(mdy_hm),transform_ui.R
As date/time (dmy_hms),作为日期时间(dmy_hms),transform_ui.R
As date/time (dmy_hm),作为日期时间(dmy_hm),transform_ui.R
As date/time (ymd_hms),作为日期时间(ymd_hms),transform_ui.R
As date/time (ymd_hm),作为日期时间(ymd_hm),transform_ui.R
None (summarize),无(汇总),transform_ui.R
Bin,分箱,transform_ui.R
Change type,更改类型,transform_ui.R
Remove/reorder levels,移除/重新排序级别,transform_ui.R
Rename,重命名,transform_ui.R
Create,创建,transform_ui.R
Remove missing values,移除缺失值,transform_ui.R
Remove/reorder variables,移除/重新排序变量,transform_ui.R
Remove duplicates,移除重复值,transform_ui.R
Show duplicates,显示重复值,transform_ui.R
Expand grid,扩展网格,transform_ui.R
Table‑to‑data,表格转数据,transform_ui.R
Holdout sample,保留样本,transform_ui.R
Training variable,训练变量,transform_ui.R
Gather columns,汇集列,transform_ui.R
Spread column,扩展列,transform_ui.R
Transform command log:,转换命令日志:,transform_ui.R
Generating summary statistics,生成摘要统计,transform_ui.R
Hide summaries,隐藏摘要,transform_ui.R
Transformation type:,转换类型:,transform_ui.R
Change variable type:,更改变量类型:,transform_ui.R
Start year:,起始年份:,transform_ui.R
Start period:,起始周期:,transform_ui.R
End year:,结束年份:,transform_ui.R
End period:,结束周期:,transform_ui.R
Frequency:,频率:,transform_ui.R
"Type a formula to create a new variable (e.g., x = y - z) and press return",输入公式以创建新变量(例如 x = y - z)并按回车,transform_ui.R
Copy-and-paste data with a header row from a spreadsheet,从电子表格复制并粘贴带有标题行的数据,transform_ui.R
Recode,重编码,transform_ui.R
"Select a variable, specify how it should be recoded (e.g., lo:20 = 0; else = 1), and press return",选择一个变量,指定如何重新编码(例如 lo:20 = 0;else = 1),并按回车,transform_ui.R
Store changes in:,将更改存储在:,transform_ui.R
Select variables to show:,选择要显示的变量:,view_ui.R
Clear settings,清除设置,view_ui.R
Store filtered data as:,将筛选后的数据存储为:,view_ui.R
Dataset '{dataset}' was successfully added to the datasets dropdown. Add code to Report > Rmd or Report > R to (re)create the dataset by clicking the report icon on the bottom left of your screen.,数据集'{dataset}'已成功添加到数据集下拉菜单中。点击左下角的报告图标,在Report > Rmd或Report > R中添加代码以(重新)创建该数据集。,view_ui.R
Generating view table,正在生成查看表格,view_ui.R
_view,_视图,view_ui.R
Provide data name,提供数据名称,"view_ui.R,crs_ui.R,conjoint_ui.R"
All,全部,"view_ui.R,evalbin_ui.R, evalreg_ui.R"
"Table slice {input$view_tab_slice} will be applied on Download, Store, or Report",表格切片 {input$view_tab_slice} 将应用于下载、存储或报告,view_ui.R
Dataset ',数据集 ',view_ui.R
' was successfully added to the datasets dropdown. Add code to Report > Rmd or Report > R to (re)create the dataset by clicking the report icon on the bottom left of your screen.,' 已成功添加到数据集下拉菜单中。通过点击左下角的报告图标,在 Report > Rmd 或 Report > R 中添加代码以(重新)创建数据集。,view_ui.R
Distribution,分布,"visualize_ui.R,logistic_ui.R"
Surface,表面图,visualize_ui.R
Line,折线图,"visualize_ui.R,regress_ui.R"
Box-plot,箱线图,visualize_ui.R
Loess,局部加权回归,"visualize_ui.R,regress_ui.R"
Jitter,抖动,"visualize_ui.R,regress_ui.R"
Interpolate,插值,visualize_ui.R
Log X,对数X,visualize_ui.R
Log Y,对数Y,visualize_ui.R
Scale-y,缩放Y,visualize_ui.R
Sort,排序,visualize_ui.R
Gray,灰色,visualize_ui.R
Black and White,黑白,visualize_ui.R
Light,浅色,visualize_ui.R
Dark,深色,visualize_ui.R
Minimal,简约,visualize_ui.R
Classic,经典,visualize_ui.R
title,标题,visualize_ui.R
subtitle,副标题,visualize_ui.R
caption,说明,visualize_ui.R
x,X轴,visualize_ui.R
y,Y轴,visualize_ui.R
Theme default,默认字体,visualize_ui.R
Helvetica,Helvetica字体,visualize_ui.R
Serif,衬线字体,visualize_ui.R
Sans,无衬线字体,visualize_ui.R
Mono,等宽字体,visualize_ui.R
Courier,Courier字体,visualize_ui.R
Times,Times字体,visualize_ui.R
dataset, "数据集", "visualize_ui.R"
data_filter, "数据筛选", "visualize_ui.R"
arr, "排序", "visualize_ui.R"
rows, "行", "visualize_ui.R"
labs, "标签", "visualize_ui.R"
Plot-type:, "绘图类型:", "visualize_ui.R"
Y-variable:, "Y变量:", "visualize_ui.R"
X-variable:, "X变量:", "visualize_ui.R"
Combine Y-variables in one plot, "将Y变量合并到一个图表中", "visualize_ui.R"
Combine X-variables in one plot, "将X变量合并到一个图表中", "visualize_ui.R"
Facet row:, "分面行:", "visualize_ui.R"
Facet column:, "分面列:", "visualize_ui.R"
Color:, "颜色", "visualize_ui.R"
Main, "主要", "visualize_ui.R"
Function:, "函数:", "visualize_ui.R"
Labels, "标签", "visualize_ui.R"
Style, "样式", "visualize_ui.R"
Plot theme:, "图表主题:", "visualize_ui.R"
Base font size:, "基本字体大小:", "visualize_ui.R"
Font family:, "字体系列:", "visualize_ui.R"
Opacity:, "透明度:", "visualize_ui.R"
Plot height:, "图表高度:", "visualize_ui.R"
Plot width:, "图表宽度:", "visualize_ui.R"
Smooth:, "平滑:", "visualize_ui.R"
Create plot, "创建图表", "visualize_ui.R"
Update plot, "更新图表", "visualize_ui.R"
Save visualize plot, "保存可视化图表", "visualize_ui.R"
Please select variables from the dropdown menus to create a plot, "请选择下拉菜单中的变量以创建图表", "visualize_ui.R"
No Y-variable provided for a plot that requires one, "没有提供Y变量,无法绘制需要Y变量的图表", "visualize_ui.R"
Title, "标题", "visualize_ui.R"
Subtitle, "副标题", "visualize_ui.R"
Caption, "说明", "visualize_ui.R"
Y-label, "Y轴标签", "visualize_ui.R"
X-label, "X轴标签", "visualize_ui.R"
Fill color:, "填充颜色:", "visualize_ui.R"
Line color:, "线条颜色:", "visualize_ui.R"
Point color:, "点的颜色:", "visualize_ui.R"
Rnd. seed:,随机种子:,"doe_ui.R, randomizer_ui.R, sampling_ui.R"
Interactions:,交互:,"doe_ui.R,conjoint_ui.R,logistic_ui.R"
Level :,水平 :,doe_ui.R
Create design,生成设计,doe_ui.R
Max levels:,最大水平数:,doe_ui.R
# trials:,试验次数:,doe_ui.R
"Upload an experimental design using the 'Upload factors' button or create a new design using the inputs on the left of the screen. For help, click the ? icon on the bottom left of the screen",使用“上传因素”按钮上传实验设计,或通过页面左侧的输入创建新设计。如需帮助,请点击左下角的?图标。,doe_ui.R
Add variable,添加变量,"doe_ui.R,dtree_ui.R, simulater_ui.R"
Remove variable,移除变量,"doe_ui.R,simulater_ui.R"
Partial,部分,doe_ui.R
Full,全部,doe_ui.R
Factors,因素,doe_ui.R
Upload factors:,上传因素:,doe_ui.R
Upload DOE factors,上传实验因素,doe_ui.R
Save factorial design:,保存实验设计:,doe_ui.R
Save factors:,保存因素:,doe_ui.R
Design factors:,实验因素,doe_ui.R
Generated experimental design:,生成的实验设计:,doe.R
Level 1:,水平 1:,doe_ui.R
Level 2:,水平 2:,doe_ui.R
Design > DOE,设计 > 实验设计,doe_ui.R
Design of Experiments,实验设计,"doe_ui.R,init.R"
Variables:,变量:,"randomizer_ui.R, sampling_ui.R,full_factor_ui.R"
Blocking variables:,分组变量:,randomizer_ui.R
Select blocking variables,选择分组变量,randomizer_ui.R
Condition labels:,条件标签:,randomizer_ui.R
Provide a name,请输入名称,"randomizer_ui.R, sampling_ui.R"
Assign conditions,分配条件,randomizer_ui.R
Re-assign conditions,重新分配条件,randomizer_ui.R
Design > Sample,设计 > 抽样,"randomizer_ui.R, sample_size_comp.R, sample_size_ui.R, sampling_ui.R"
Random assignment,随机分配,"randomizer_ui.R,init.R"
Save random assignment,保存随机分配,randomizer_ui.R
"For random assignment each row in the data should be distinct (i.e., no duplicates). Please select an appropriate dataset.","每条记录都应唯一(无重复)。请选择合适的数据集。
",randomizer_ui.R
Type condition labels separated by comma's and press return,输入条件标签(用逗号分隔),然后按回车,randomizer_ui.R
Condition variable name:,条件变量名:,randomizer_ui.R
Provide a variable name,请输入变量名,randomizer_ui.R
Sample size (compare),样本量(比较),"sample_size_comp_ui.R,init.R"
Sample size (n1):,样本量 (n1):,sample_size_comp.R
Sample size (n2):,样本量 (n2):,sample_size_comp.R
Proportion:,比例,"sample_size_comp.R, sample_size_ui.R"
Delta:,差异值:,sample_size_comp.R
Standard deviation:,标准差,"sample_size_comp.R, sample_size_ui.R"
Power:,效能,sample_size_comp.R
Group 1 less than Group 2,组1 小于 组2,sample_size_comp.R
Group 1 greater than Group 2,组1 大于 组2,sample_size_comp.R
Show plot,显示图形,sample_size_comp.R
Save sample size comparison plot,保存样本量比较图,sample_size_comp.R
Yes,是,sample_size_ui.R
No,否,sample_size_ui.R
"The acceptable error is the level of precision you require (i.e., the range within which the true mean should lie). For example, ± $10. A lower acceptable error requires a larger sample size.",可接受误差是您要求的精度范围(例如,±10美元)。更小的误差要求更大的样本量。,sample_size_ui.R
Acceptable Error:,可接受误差:,sample_size_ui.R
"How much variation is there likely to be in the population? This number is often determined from a previous survey or a pilot study. The higher the standard deviation, the larger the required sample size.",总体可能存在多大的变异?通常通过前期调查或试点研究确定。标准差越大,所需样本量越大。,sample_size_ui.R
What do you expect the sample proportion to be? This number is often determined from a previous survey or a pilot study. If no such information is availabvle use 0.5.,您期望的样本比例是多少?通常通过前期调查或试点研究确定。如无信息请使用0.5。,sample_size_ui.R
"Common values for the confidence level are 0.9, 0.95, and 0.99",置信水平常用值为0.9、0.95 和 0.99,sample_size_ui.R
The probability that a respondent will be part of the target segment of interest,受访者属于目标群体的概率,sample_size_ui.R
Incidence rate:,发生率:,sample_size_ui.R
The probability of a response,响应的概率,sample_size_ui.R
Response rate:,响应率:,sample_size_ui.R
If the sample size is relatively larger compared to the size of the target population you should consider adjusting for population size,如果样本量相对于总体较大,建议调整总体规模,sample_size_ui.R
Correct for population size:,考虑总体规模修正:,sample_size_ui.R
Size of the target population of interest,目标总体的规模,sample_size_ui.R
Population size:,总体规模:,sample_size_ui.R
Sample size (single),样本量(单个),"sample_size_ui.R,init.R"
"The acceptable error is the level of precision you require (i.e., the range within which the true proportion should lie). For example, ± 0.02. A lower acceptable error requires a larger sample size.",可接受误差是您要求的精度范围(例如,±0.02)。更小的误差要求更大的样本量。,sample_size_ui.R
Proportion 1 (p1):,比例 1(p1):,sample_size_comp.R
Proportion 2 (p2):,比例 2(p2):,sample_size_comp.R
No valid sample available,无可用的样本数据,sampling_ui.R
Select at least one variable,请至少选择一个变量,sampling_ui.R
Some selected variables are not available in this dataset,部分选择的变量在数据集中不可用,sampling_ui.R
"For random sampling each row in the data should be distinct(i.e., no duplicates). Please select an appropriate dataset.",为了进行随机抽样,数据中的每一行都应是唯一的(即没有重复项)。请选择一个合适的数据集。\n\n,sampling_ui.R
Please select a sample size of 1 or greater,请选择一个大于等于 1 的样本量,sampling_ui.R
Selected cases,选中的样本,sampling_ui.R
Sampling frame,抽样框架,sampling_ui.R
Sampling,随机抽样,sampling_ui.R
Random sampling,随机抽样,"sampling_ui.R,init.R"
Show sampling frame ,显示抽样框,sampling_ui.R
Proportion,比例,sample_size_ui.R
User id:,用户 ID:,crs_ui.R
Product id:,产品 ID:,crs_ui.R
Choose products to recommend:,选择要推荐的产品:,crs_ui.R
Ratings variable:,评分变量:,crs_ui.R
Estimate model,估计模型,"crs_ui.R, crtree_ui.R, gbt_ui.R, logistic_ui.R,conjoint_ui.R"
Re-estimate model,重新估计模型,"crs_ui.R, crtree_ui.R, gbt_ui.R, logistic_ui.R,conjoint_ui.R"
<label>Store recommendations:</label>,<label>保存推荐结果:</label>,crs_ui.R
Collaborative Filtering,协同过滤,"crs_ui.R,init.R"
Model > Recommend,模型 > 推荐,crs_ui.R
"This analysis requires a user id, a product id, and product ratings.
If these variables are not available please select another dataset.
","此分析需要用户 ID、产品 ID 和评分变量。
如果这些变量不存在,请选择另一个数据集。
",crs_ui.R
"A data filter or slice must be set to generate recommendations using
collaborative filtering. Add a filter or slice in the Data > View tab.
Note that the users in the training sample should not overlap
with the users in the test sample.","必须设置数据过滤或切片才能使用协同过滤生成推荐。
在“数据 > 查看”选项卡中添加过滤器或切片。
注意:训练集和测试集中的用户不应重叠。",crs_ui.R
"An invalid filter has been set for this dataset. Please
adjust the filter in the Data > View tab and try again","此数据集设置了无效的过滤条件。
请在“数据 > 查看”中调整过滤条件并重试。",crs_ui.R
Please select one or more products to generate recommendations,请选择一个或多个产品以生成推荐,crs_ui.R
Estimating model,正在估计模型,"crs_ui.R, crtree_ui.R,conjoint_ui.R"
** Press the Estimate button to generate recommendations **,** 请点击“估计模型”按钮以生成推荐 **,crs_ui.R
No data selected to generate recommendations,未选择任何数据用于生成推荐,crs_ui.R
Dataset '{fixed}' was successfully added to the datasets dropdown. Add code to Report > Rmd or Report > R to (re)create the dataset by clicking the report icon on the bottom left of your screen.,数据集“{fixed}”已成功添加到数据下拉菜单中。要在报告中(重新)生成该数据集,请点击左下角的报告图标,并添加到“报告 > Rmd”或“报告 > R”。,crs_ui.R
No recommendations available,无推荐结果可用,crs_ui.R
Save collaborative filtering recommendations,保存协同过滤推荐结果,crs_ui.R
Save collaborative filtering plot,保存协同过滤图表,crs_ui.R
Prune,修剪,crtree_ui.R
Tree,决策树,crtree_ui.R
Permutation Importance,特征重要性,"crtree_ui.R, gbt_ui.R"
Prediction plots,预测图,"crtree_ui.R, gbt_ui.R"
Partial Dependence,部分依赖图,"crtree_ui.R, gbt_ui.R"
Dashboard,仪表盘,"crtree_ui.R, gbt_ui.R"
Response variable:,因变量:,"crtree_ui.R, evalbin_ui.R, evalreg_ui.R, gbt_ui.R, logistic_ui.R"
Explanatory variables:,自变量:,"crtree_ui.R, gbt_ui.R, logistic_ui.R"
Explanatory variables to include:,包含的自变量:,"crtree_ui.R, logistic_ui.R"
2-way interactions to explore:,要探索的二阶交互项:,"crtree_ui.R, logistic_ui.R"
Weights:,权重:,"crtree_ui.R, gbt_ui.R, logistic_ui.R"
classification,分类,"crtree_ui.R, gbt_ui.R"
regression,回归,"crtree_ui.R, gbt_ui.R"
Prior:,先验:,crtree_ui.R
Min obs.:,最小观测数:,crtree_ui.R
Cost:,成本:,"crtree_ui.R, evalbin_ui.R"
Margin:,边际:,"crtree_ui.R, evalbin_ui.R"
Complexity:,复杂度:,crtree_ui.R
Max. nodes:,最大节点数:,crtree_ui.R
Prune compl.:,修剪复杂度:,crtree_ui.R
Store residuals:,存储残差:,"crtree_ui.R, logistic_ui.R"
Provide variable name,输入变量名称,"crtree_ui.R,hclus_ui.R"
Classification and regression trees,分类与回归树,"crtree_ui.R,init.R"
Prediction input type:,预测输入类型:,"crtree_ui.R, gbt_ui.R, logistic_ui.R,conjoint_ui.R"
Prediction data:,预测数据:,"crtree_ui.R, gbt_ui.R,conjoint_ui.R"
Prediction command:,预测指令:,"crtree_ui.R, gbt_ui.R, logistic_ui.R,conjoint_ui.R"
"Type a formula to set values for model variables (e.g., carat = 1; cut = 'Ideal') and press return",在此输入用于模型预测的变量值 (如 carat = 1; cut = 'Ideal') 并按回车键,"crtree_ui.R, gbt_ui.R, naivebayes_ui.R"
Plot predictions,绘制预测图,"crtree_ui.R, gbt_ui.R, logistic_ui.R,conjoint_ui.R"
Store predictions:,存储预测值:,"crtree_ui.R, gbt_ui.R,conjoint_ui.R"
Plots:,绘图选项:,"crtree_ui.R, evalbin_ui.R, gbt_ui.R, logistic_ui.R"
Plot direction:,绘图方向:,"crtree_ui.R, dtree_ui.R"
Left-right,左-右,"crtree_ui.R, dtree_ui.R"
Top-down,上-下,"crtree_ui.R, dtree-ui.R"
Right-left,右-左,crtree_ui.R
Bottom-Top,下-上,crtree_ui.R
Width:,宽度:,crtree_ui.R
Save crtree predictions,保存预测结果,crtree_ui.R
Save decision tree prediction plot,保存预测图,crtree_ui.R
Save decision tree plot,保存决策树图,crtree_ui.R
Generating predictions,正在生成预测,"crtree_ui.R, gbt_ui.R, logistic_ui.R,conjoint_ui.R"
Generating prediction plot,正在生成预测图,"crtree_ui.R, gbt_ui.R, logistic_ui.R,conjoint_ui.R"
Generating tree diagramm,正在生成树图,crtree_ui.R
Model > Estimate,模型 > 估计,"crtree_ui.R, logistic_ui.R"
** Press the Estimate button to estimate the model **,** 点击“估计模型”按钮来估计模型 **,"crtree_ui.R, gbt_ui.R,conjoint_ui.R"
Please select one or more explanatory variables.,请选择一个或多个自变量。,"crtree_ui.R, gbt_ui.R, nn_ui.R"
Max,最大化,dtree_ui.R
Min,最小化,dtree_ui.R
Remove,删除,dtree_ui.R
"No variables are available for sensitivity analysis. If the input file does contain a variables section, press the Calculate button to show the list of available variables.",没有可用于敏感性分析的变量。如果输入文件包含 variables 部分,请点击“计算树”按钮以显示可用变量列表。,dtree_ui.R
Sensitivity to changes in:,敏感性分析变量:,dtree_ui.R
Decisions to evaluate:,要评估的决策:,dtree_ui.R
Select decisions to evaluate,选择要评估的决策,dtree_ui.R
"<label>Add variable: <i id='dtree_sense_add' title='Add variable' href='#' class='action-button fa fa-plus-circle'></i>
<i id='dtree_sense_del' title='Remove variable' href='#' class='action-button fa fa-minus-circle'></i></label>","<label>添加变量: <i id='dtree_sense_add' title='添加变量' href='#' class='action-button fa fa-plus-circle'></i>
<i id='dtree_sense_del' title='删除变量' href='#' class='action-button fa fa-minus-circle'></i></label>",dtree_ui.R
Step:,步长:,dtree_ui.R
Model,模型,"dtree_ui.R,init.R"
Decision analysis,决策分析,"dtree_ui.R,init.R"
<i title='Report results' class='fa fa-edit action-button' href='#dtree_report1' id='dtree_report1'></i>,<i title='报告结果' class='fa fa-edit action-button' href='#dtree_report1' id='dtree_report1'></i>,dtree_ui.R
<i title='Report results & Screenshot' class='fa fa-camera action-button aligncenter' href='#dtree_screenshot1' id='dtree_screenshot1' onclick='generate_screenshot();'></i>,<i title='报告结果并截图' class='fa fa-camera action-button aligncenter' href='#dtree_screenshot1' id='dtree_screenshot1' onclick='generate_screenshot();'></i>,dtree_ui.R
Calculate tree,计算树,dtree_ui.R
Load input,加载输入,dtree_ui.R
Load decision tree input file (.yaml),加载决策树输入文件 (.yaml),dtree_ui.R
Save input,保存输入,dtree_ui.R
Save output,保存输出,dtree_ui.R
Provide structured input for a decision tree. Then click the 'Calculate tree' button to generate results. Click the ? icon on the top left of your screen for help and examples,为决策树提供结构化输入,然后点击“计算树”按钮生成结果。如需帮助和示例,请点击左上角的 ? 图标。,dtree_ui.R
<i title='Save plot' class='fa fa-download action-button alignright' href='#dtree_screenshot3' id='dtree_screenshot3' onclick='generate_dtree_plot();'></i>,<i title='保存图形' class='fa fa-download action-button alignright' href='#dtree_screenshot3' id='dtree_screenshot3' onclick='generate_dtree_plot();'></i>,dtree_ui.R
<i title='Report results' class='fa fa-edit action-button' href='' id='dtree_report2'></i>,<i title='报告结果' class='fa fa-edit action-button' href='' id='dtree_report2'></i>,dtree_ui.R
<i title='Report results & Screenshot' class='fa fa-camera action-button aligncenter' href='#dtree_screenshot2' id='dtree_screenshot2' onclick='generate_screenshot();'></i>,<i title='报告结果并截图' class='fa fa-camera action-button aligncenter' href='#dtree_screenshot2' id='dtree_screenshot2' onclick='generate_screenshot();'></i>,dtree_ui.R
Plot decision tree:,绘制决策树:,dtree_ui.R
Initial,初始,dtree_ui.R
Final,最终,dtree_ui.R
Decimals,小数位,dtree_ui.R
Symbol,符号,dtree_ui.R
Sensitivity,敏感性,dtree_ui.R
Evaluate sensitivity,评估敏感性,dtree_ui.R
At least one decision should be selected for evaluation,至少应选择一个决策进行评估,dtree_ui.R
No variables were specified for evaluation.\nClick the + icon to add variables for sensitivity evaluation,未指定任何变量用于评估。\n点击 + 图标添加要进行敏感性评估的变量,dtree_ui.R
Conducting sensitivity analysis,正在进行敏感性分析,dtree_ui.R
Creating decision tree,正在创建决策树,dtree_ui.R
** Click the calculate button to generate results **,** 请点击计算按钮以生成结果 **,dtree_ui.R
Save decision tree output,保存决策树输出,dtree_ui.R
Save decision tree input,保存决策树输入,dtree_ui.R
Save decision tree sensitivity plot,保存敏感性分析图,dtree_ui.R
Lift,提升图,evalbin_ui.R
Gains,收益图,evalbin_ui.R
Profit,利润图,evalbin_ui.R
Expected profit,预期利润,evalbin_ui.R
ROME,投资回报率,evalbin_ui.R
Training,训练集,"evalbin_ui.R, evalreg_ui.R"
Test,测试集,"evalbin_ui.R, evalreg_ui.R"
Both,训练集与测试集,"evalbin_ui.R, evalreg_ui.R"
Incremental uplift,增量提升,evalbin_ui.R
Uplift,提升,evalbin_ui.R
Incremental profit,增量利润,evalbin_ui.R
More than 50 levels. Please choose another response variable,超过 50 个水平。请选择其他响应变量,evalbin_ui.R
Treatment variable:,处理变量:,evalbin_ui.R
Select stored predictions:,选择已保存的预测:,"evalbin_ui.R, evalreg_ui.R"
Show results for:,显示结果:,"evalbin_ui.R, evalreg_ui.R"
Store uplift table as:,保存提升表为:,evalbin_ui.R
Evaluate models,评估模型,"evalbin_ui.R, evalreg_ui.R"
Re-evaluate models,重新评估模型,"evalbin_ui.R, evalreg_ui.R"
# quantiles:,分位数数量:,evalbin_ui.R
Scale:,缩放因子:,evalbin_ui.R
Show model performance table,显示模型性能表,evalbin_ui.R
Show uplift table,显示提升表,evalbin_ui.R
Show plots,显示图形,"evalbin_ui.R, evalreg_ui.R"
Scale free,统一纵轴,evalbin_ui.R
Evaluate classification,分类模型评估,"evalbin_ui.R,init.R"
Confusion matrix,混淆矩阵,evalbin_ui.R
Evaluate uplift,评估提升效果,evalbin_ui.R
Uplift Table Stored,提升表已保存,evalbin_ui.R
The uplift table ',提升表 ',evalbin_ui.R
"' was successfully added to the
datasets dropdown. Add code to Report > Rmd or
Report > R to (re)create the results by clicking
the report icon on the bottom left of your screen.",' 已成功添加到数据集下拉菜单。可在 Report > Rmd 或 Report > R 中添加代码以(重新)生成结果,方法是点击屏幕左下角的报告图标。,evalbin_ui.R
Save model evaluations,保存模型评估结果,"evalbin_ui.R, evalreg_ui.R"
Save model performance metrics,保存模型性能指标,evalbin_ui.R
Save uplift evaluations,保存提升评估结果,evalbin_ui.R
Save model evaluation plot,保存模型评估图,"evalbin_ui.R, evalreg_ui.R"
Save confusion plots,保存混淆图,evalbin_ui.R
Save uplift plots,保存提升图,evalbin_ui.R
Evaluate,评估,"evalbin_ui.R,init.R"
Model > Evaluate,模型 > 评估,"evalbin_ui.R, evalreg_ui.R"
** Press the Evaluate button to evaluate models **,** 请点击“评估”按钮以评估模型 **,"evalbin_ui.R, evalreg_ui.R"
<label>More than 50 levels. Please choose another response variable</label>,<label>超过 50 个水平。请选择其他响应变量</label>,evalbin_ui.R
"This analysis requires a response variable of type factor and one or more
predictors of type numeric. If these variable types are not available please
select another dataset.
For an example dataset go to Data > Manage, select 'examples' from the
'Load data of type' dropdown, and press the 'Load examples' button. Then
select the 'titanic' dataset.","此分析需要一个因变量(类别型)和一个或多个自变量(数值型)。如果这些变量类型不可用,请选择另一个数据集。
如需示例数据集,请前往“数据 > 管理”,在“加载数据类型”下拉菜单中选择“示例”,然后点击“加载示例”按钮。接着选择“titanic”数据集。",evalbin_ui.R
"This analysis requires a response variable of type factor and one or more
predictors of type numeric. If these variable types are not available please
select another dataset.
",此分析需要一个因变量(类别型)和一个或多个自变量(数值型)。如果这些变量类型不可用,请选择另一个数据集。,evalbin_ui.R
Evaluate Regression,回归模型评估,evalreg_ui.R
This analysis requires a numeric response variable and one or more\nnumeric predictors. If these variable types are not available please\nselect another dataset.\n\n,本分析要求一个数值型因变量和一个或多个数值型自变量。如果当前数据集中不包含这些类型的变量,请选择另一个数据集。\n\n,evalreg_ui.R
Choose first level:,选择第一个水平:,gbt_ui.R
Max depth:,最大深度:,gbt_ui.R
Learning rate:,学习率:,gbt_ui.R
Min split loss:,最小分裂损失:,gbt_ui.R
Min child weight:,最小子节点权重:,gbt_ui.R
Sub-sample:,子样本比例:,gbt_ui.R
# rounds:,迭代轮数:,gbt_ui.R
Early stopping:,提前停止:,gbt_ui.R
Gradient Boosted Trees,梯度提升树,"gbt_ui.R,init.R"
Model > Trees,模型 > 树模型,gbt_ui.R
** Select prediction input **,** 请选择预测输入 **,"gbt_ui.R, logistic_ui.R,conjoint_ui.R"
** Select data for prediction **,** 请选择用于预测的数据 **,"gbt_ui.R, logistic_ui.R,conjoint_ui.R"
** Enter prediction commands **,** 请输入预测命令 **,"gbt_ui.R, logistic_ui.R,conjoint_ui.R"
Please select a gradient boosted trees plot from the drop-down menu,请从下拉菜单中选择一个梯度提升树图表,gbt_ui.R
Storing predictions,正在保存预测结果,"gbt_ui.R, logistic_ui.R,conjoint_ui.R"
No output available. Press the Estimate button to generate results,无可用输出。请点击“估计模型”按钮生成结果,"gbt_ui.R, logistic_ui.R,conjoint_ui.R"
Save predictions,保存预测结果,"gbt_ui.R, logistic_ui.R,conjoint_ui.R"
Save gradient boosted trees prediction plot,保存梯度提升树预测图,gbt_ui.R
Save gradient boosted trees plot,保存梯度提升树图,gbt_ui.R
This analysis requires a response variable with two levels and one\nor more explanatory variables. If these variables are not available\nplease select another dataset.\n\n,此分析需要一个具有两个水平的响应变量和一个\n或多个解释变量。如果这些变量不可用\n请选择其他数据集。\n\n,gbt_ui.R
This analysis requires a response variable of type integer\nor numeric and one or more explanatory variables.\nIf these variables are not available please select another dataset.\n\n,此分析需要一个整数类型的响应变量\n或数值型,以及一个或多个解释变量。\n如果这些变量不可用,请选择其他数据集。\n\n,gbt_ui.R
Predict,预测,"gbt_ui.R,conjoint_ui.R"
Storing residuals,存储残差,logistic_ui.R
Save coefficients,保存系数,logistic_ui.R
Save logistic prediction plot,保存逻辑回归预测图,logistic_ui.R
Save logistic plot,保存逻辑回归图,logistic_ui.R
Variables to test:,测试的变量:,logistic_ui.R
"Type a formula to set values for model variables (e.g., class = '1st'; gender = 'male') and press return",输入公式设置模型变量的值(例如,class = '1st'; gender = 'male'),然后按回车,logistic_ui.R
Include intercept,包含截距,logistic_ui.R
Logistic regression (GLM),逻辑回归(广义线性模型),"logistic_ui.R,init.R"
Logistic regression,逻辑回归,logistic_ui.R
3-way,三因素交互,"logistic_ui.R,conjoint_ui.R"
Data,数据,"logistic_ui.R,conjoint_ui.R,global.R"
Command,命令,"logistic_ui.R,conjoint_ui.R"
Data & Command,数据和命令,"logistic_ui.R,conjoint_ui.R"
Stepwise, "逐步回归", "logistic_ui.R"
Robust, "稳健", "logistic_ui.R"
VIF,方差膨胀因子,"logistic_ui.R,conjoint_ui.R"
Confidence intervals, "置信区间", "logistic_ui.R"
Odds, "赔率", "logistic_ui.R"
Correlations, "相关性", "logistic_ui.R"
Model fit, "模型拟合", "logistic_ui.R"
Coefficient (OR) plot, "系数(OR)图", "logistic_ui.R"
Influential observations, "影响观察值", "logistic_ui.R"
This analysis requires a response variable with two levels and one or more explanatory variables. If these variables are not available please select another dataset.,该分析需要一个具有两个级别的响应变量以及一个或多个解释变量。如果这些变量不可用,请选择另一个数据集。, "logistic_ui.R"
Drop intercept,去除截距项,mnl_ui.R
RRRs,相对风险比 (RRR),mnl_ui.R
Coefficient (RRR) plot,系数图(RRR),mnl_ui.R
Multinomial logistic regression (MNL),多项式逻辑回归(MNL),"mnl_ui.R,init.R"
Save mnl prediction plot,保存 MNL 预测图,mnl_ui.R
Save mnl plot,保存 MNL 图表,mnl_ui.R
Please select a mnl regression plot from the drop-down menu,请从下拉菜单中选择一个 MNL 回归图,mnl_ui.R
Choose base level:,选择基准水平:,mnl_ui.R
Variable importance,变量重要性,naivebayes_ui.R
Naive Bayes,朴素贝叶斯,"naivebayes_ui.R,init.R"
Laplace:,拉普拉斯修正:,naivebayes_ui.R
Save naive Bayes prediction plot,保存朴素贝叶斯预测图,naivebayes_ui.R
Save naive Bayes plot,保存朴素贝叶斯图,naivebayes_ui.R
Please select a naive Bayes plot from the drop-down menu,请从下拉菜单中选择一个朴素贝叶斯图,naivebayes_ui.R
All levels,所有水平,naivebayes_ui.R
Network,网络结构,nn_ui.R
Olden,节点权重贡献图(Olden 方法),nn_ui.R
Garson,输入变量重要性图(Garson 方法),nn_ui.R
Neural Network,神经网络,"nn_ui.R,init.R"
Regression,回归,nn_ui.R
Decay:,衰减:,nn_ui.R
Save neural network prediction plot,保存神经网络预测图,nn_ui.R
Save neural network plot,保存神经网络图,nn_ui.R
Please select a neural network plot from the drop-down menu,请从下拉菜单中选择一种神经网络图,nn_ui.R
RMSE,均方根误差,regress_ui.R
Sum of squares,平方和,regress_ui.R
Residual vs explanatory,残差对解释变量图,regress_ui.R
Coefficient plot,系数图,regress_ui.R
Linear regression (OLS),线性回归(普通最小二乘法),"regress_ui.R,init.R"
Save regression predictions,保存回归预测结果,regress_ui.R
Save regression plot,保存回归图表,regress_ui.R
Please select one or more explanatory variables. Then press the Estimate\nbutton to estimate the model.,请选择一个或多个解释变量,然后点击“估计模型”按钮。,regress_ui.R
Save regression prediction plot,保存回归预测图,regress_ui.R
Please select a regression plot from the drop-down menu,请从下拉菜单中选择一个回归图,regress_ui.R
Random Forest,随机森林,"rforest_ui.R,init.R"
mtry:,mtry:特征子集数,rforest_ui.R
# trees:,树数量:,rforest_ui.R
Min node size:,最小节点样本数:,rforest_ui.R
Sample fraction:,样本抽样比例:,rforest_ui.R
Save random forest plot,保存随机森林图,rforest_ui.R
Constant,常数,simulater_ui.R
Grid search,网格搜索,simulater_ui.R
Sequence,序列,simulater_ui.R
Repeat simulation,重复模拟,simulater_ui.R
<label>Simulation formulas:</label>,<label>模拟公式:</label>,simulater_ui.R
"Use formulas to perform calculations on simulated variables
(e.g., demand = 5 * price). Press the Run simulation button
to run the simulation. Click the ? icon on the bottom left
of your screen for help and examples",使用公式对模拟变量进行计算(例如:demand = 5 * price)。点击“运行模拟”按钮开始模拟。点击左下角的问号图标查看帮助和示例。,simulater_ui.R
</br><label>Simulation functions:</label>,</br><label>模拟函数:</label>,simulater_ui.R
"Create your own R functions (e.g., add = function(x, y) {x + y}).
Call these functions from the 'formula' input and press the Run
simulation button to run the simulation. Click the ? icon on the
bottom left of your screen for help and examples","创建你自己的 R 函数(例如:add = function(x, y) {x + y})。在“公式”输入框中调用这些函数并点击“运行模拟”按钮。点击左下角的问号图标查看帮助和示例。",simulater_ui.R
Repeat,重复,simulater_ui.R
<label>Repeated simulation formulas:</label>,<label>重复模拟公式:</label>,simulater_ui.R
"Press the Repeat simulation button to repeat the simulation specified in the
Simulate tab. Use formulas to perform additional calculations on the repeated
simulation data. Click the ? icon on the bottom left of your screen for help
and examples",点击“重复模拟”按钮,对“模拟”页中指定的模拟进行重复执行。你可以使用公式对重复模拟的数据执行额外计算。点击左下角的问号图标查看帮助和示例。,simulater_ui.R
</br><label>Repeated simulation functions:</label>,</br><label>重复模拟函数:</label>,simulater_ui.R
</br><label>Repeated simulation summary:</label>,</br><label>重复模拟汇总:</label>,simulater_ui.R
</br><label>Repeated simulation plots:</label>,</br><label>重复模拟图表:</label>,simulater_ui.R
Model > Decide,建模 > 决策,simulater_ui.R
Name:,名称:,simulater_ui.R
Prob.:,概率:,simulater_ui.R
St.dev.:,标准差:,simulater_ui.R
Use exact specifications,使用精确指定,simulater_ui.R
Correlations:,相关性:,simulater_ui.R
Set random seed:,设置随机种子:,"simulater_ui.R,kclus_ui.R"
# sims:,模拟次数:,simulater_ui.R
Simulated data:,模拟数据:,simulater_ui.R
Add functions,添加函数,simulater_ui.R
Select types,选择类型,simulater_ui.R
Select types:,选择类型:,simulater_ui.R
Save simulation plots,保存模拟图表,simulater_ui.R
** Press the Repeat simulation button **,** 请点击“重复模拟”按钮 **,simulater_ui.R
sum,求和,simulater_ui.R
mean,均值,simulater_ui.R
median,中位数,simulater_ui.R
min,最小值,simulater_ui.R
max,最大值,simulater_ui.R
sd,标准差,simulater_ui.R
var,方差,simulater_ui.R
sdprop,标准差比例,simulater_ui.R
varprop,方差比例,simulater_ui.R
p01,第1百分位数,simulater_ui.R
p025,第2.5百分位数,simulater_ui.R
p05,第5百分位数,simulater_ui.R
p10,第10百分位数,simulater_ui.R
p25,第25百分位数,simulater_ui.R
p75,第75百分位数,simulater_ui.R
p90,第90百分位数,simulater_ui.R
p95,第95百分位数,simulater_ui.R
p975,第97.5百分位数,simulater_ui.R
p99,第99百分位数,simulater_ui.R
first,第一个值,simulater_ui.R
last,最后一个值,simulater_ui.R
Provide values in the input boxes above and then press the + symbol,请在上方输入框中填写数值,然后点击加号按钮,simulater_ui.R
# reps:,重复次数:,simulater_ui.R
Repeat data:,重复模拟数据:,simulater_ui.R
No formulas or simulated variables specified,未指定任何公式或模拟变量,simulater_ui.R
Running simulation,正在运行模拟,simulater_ui.R
Generating simulation plots,正在生成模拟图表,simulater_ui.R
</br><label>Simulation summary:</label>,</br><label>模拟摘要:</label>,simulater_ui.R
</br><label>Simulation plots:</label>,</br><label>模拟图表:</label>,simulater_ui.R
Simulation,模拟,simulater_ui.R
Binomial variables:, "二项变量:", "simulater_ui.R"
Grid search:, "网格搜索:", "simulater_ui.R"
Save repeated simulation plots, "保存重复模拟图", "simulater_ui.R"
Inputs required, "需要输入", "simulater_ui.R"
Select at least one Output variable, "请至少选择一个输出变量", "simulater_ui.R"
Constant variables,常量变量,simulater_ui.R
Discrete variables,离散变量,simulater_ui.R
Log-normal variables,对数正态变量,simulater_ui.R
Normal variables,正态变量,simulater_ui.R
Poisson variables,泊松变量,simulater_ui.R
Uniform variables,均匀变量,simulater_ui.R
Sequence variables,序列变量,simulater_ui.R
2-way,双因素交互,conjoint_ui.R
Part-worths,部分效用,conjoint_ui.R
Importance-weights,重要性权重,conjoint_ui.R
Profile evaluations:,方案评价:,conjoint_ui.R
Attributes:,属性:,conjoint_ui.R
By:,按:,conjoint_ui.R
Show:,显示:,conjoint_ui.R
Store all PWs in a new dataset:,将所有部分效用存入新数据集:,conjoint_ui.R
Store all IWs in a new dataset:,将所有重要性权重存入新数据集:,conjoint_ui.R
in new dataset:,到新数据集中:,conjoint_ui.R
Reverse evaluation scores,反转评分,conjoint_ui.R
Additional regression output,附加回归输出,conjoint_ui.R
Conjoint plots:,联合分析图:,conjoint_ui.R
Scale PW plots,缩放部分效用图,conjoint_ui.R
Conjoint,联合分析,"conjoint_ui.R,init.R"
** Press the Estimate button to run the conjoint analysis **,** 点击“估计模型”按钮运行联合分析 **,conjoint_ui.R
"This analysis requires a response variable of type integer\nor numeric and one or more explanatory variables.
If these variables are not available please select another dataset.",此分析需要一个整数或数值型的响应变量以及一个或多个解释变量。\n如果这些变量不可用,请选择其他数据集。\n\n,conjoint_ui.R
"Please select one or more explanatory variables of type factor.
If none are available please choose another dataset",请选择一个或多个因子型解释变量。\n如果没有可用变量,请选择其他数据集\n\n,conjoint_ui.R
Please select a conjoint plot from the drop-down menu,请从下拉菜单中选择一个联合分析图,conjoint_ui.R
Storing PWs,正在存储部分效用,conjoint_ui.R
Storing IWs,正在存储重要性权重,conjoint_ui.R
Storing predictions in new dataset,正在将预测结果存储到新数据集,conjoint_ui.R
Save part worths,保存部分效用,conjoint_ui.R
Save conjoint prediction plot,保存联合分析预测图,conjoint_ui.R
Save conjoint plot,保存联合分析图,conjoint_ui.R
Multivariate > Conjoint,多元分析 > 联合分析,conjoint_ui.R
Principal components,主成分,full_factor_ui.R
Maximum Likelihood,极大似然,full_factor_ui.R
Varimax,方差最大旋转,full_factor_ui.R
Quartimax,四次最大旋转,full_factor_ui.R
Equamax,均方最大旋转,full_factor_ui.R
Promax,Promax 旋转,full_factor_ui.R
Oblimin,Oblimin 旋转,full_factor_ui.R
Simplimax,简单最大旋转,full_factor_ui.R
Multivariate > Factor,多元分析 > 因子分析,full_factor_ui.R
Factor,因子分析,"full_factor_ui.R,init.R"
Respondents,受访者,full_factor_ui.R
Nr. of factors:,因子数量:,full_factor_ui.R
Cutt-off:,截断值:,full_factor_ui.R
Sort factor loadings,对因子载荷排序,full_factor_ui.R
rotation:,旋转:,full_factor_ui.R
Save factor loadings,保存因子载荷,full_factor_ui.R
** Press the Estimate button to generate factor analysis results **,** 请点击“估计模型”按钮以生成因子分析结果 **,full_factor_ui.R
Store factor scores:,存储因子得分:,full_factor_ui.R
Provide single variable name,请输入单个变量名,full_factor_ui.R
Save factor plots,保存因子图,full_factor_ui.R
Please select two or more variables,请选择两个或以上变量,full_factor_ui.R
Provide a correlation cutoff value in the range from 0 to 1,请输入 0 到 1 范围内的相关性截断值,full_factor_ui.R
Estimating factor solution,正在估计因子解,full_factor_ui.R
Generating factor plots,正在生成因子图,full_factor_ui.R
Ward's,沃德法,hclus_ui.R
Single,单连接,hclus_ui.R
Complete,全连接,hclus_ui.R
Average,平均连接,hclus_ui.R
McQuitty,麦奎蒂法,hclus_ui.R
Median,中位数法,hclus_ui.R
Centroid,质心法,hclus_ui.R
Squared euclidean,平方欧几里得,hclus_ui.R
Binary,二元距离,hclus_ui.R
Canberra,堪培拉距离,hclus_ui.R
Euclidian,欧几里得距离,hclus_ui.R
Gower,高尔距离,hclus_ui.R
Manhattan,曼哈顿距离,hclus_ui.R
Maximum,最大距离,hclus_ui.R
Minkowski,闵可夫斯基距离,hclus_ui.R
Scree,碎石图,hclus_ui.R
Change,变化图,hclus_ui.R
Dendrogram,树状图,hclus_ui.R
Multivariate > Cluster,多元分析 > 聚类,hclus_ui.R
Hierarchical,层次聚类,"hclus_ui.R,init.R"
Distance measure:,距离度量:,hclus_ui.R
Select plot(s),选择图表,hclus_ui.R
Plot(s):,图表:,hclus_ui.R
Plot cutoff:,图表截断值:,hclus_ui.R
Max cases:,最大案例数:,hclus_ui.R
Number of clusters:,聚类数:,hclus_ui.R
Store cluster membership:,保存聚类成员:,hclus_ui.R
Hierarchical cluster analysis,层次聚类分析,hclus_ui.R
Save hierarchical cluster plots,保存层次聚类图,hclus_ui.R
"This analysis requires one or more variables of type integer or numeric.
If these variable types are not available please select another dataset.","此分析需要一个或多个整数或数值型变量。如果这些变量类型不可用,请选择其他数据集。
",hclus_ui.R
Generating cluster plot,正在生成聚类图,hclus_ui.R
Labels:,标签:,hclus_ui.R
** Press the Estimate button to generate cluster solution **,** 点击“估计模型”按钮以生成聚类结果 **,hclus_ui.R
Estimating cluster solution,正在计算聚类结果,hclus_ui.R
K-means,K-均值,kclus_ui.R
K-proto,K-原型,kclus_ui.R
K-clustering,K均值聚类,"kclus_ui.R,init.R"
Algorithm:,算法:,kclus_ui.R
Initial centers from HC,使用层次聚类初始化中心,kclus_ui.R
Save clustering results ,保存聚类结果 ,kclus_ui.R
** Press the Estimate button to generate the cluster solution **,** 请点击“估计模型”按钮以生成聚类结果 **,kclus_ui.R
"This analysis requires one or more variables of type numeric or integer.
If these variable types are not available please select another dataset.",此分析需要一个或多个数值型或整数型变量。\n如果这些变量类型不可用,请选择其他数据集。,kclus_ui.R
Save k-cluster plots,保存 K-聚类图,kclus_ui.R
Please select a plot type from the drop-down menu,请从下拉菜单中选择图表类型,kclus_ui.R
"This analysis requires multiple variables of type numeric or integer.
If these variables are not available please select another dataset.",该分析需要多个数值型或整数型变量。\n如果这些变量不可用,请选择其他数据集。,full_factor_ui.R
"Plot requires 2 or more factors.
Change the number of factors in the Summary tab and re-estimate",绘图需要 2 个或更多因子。\n请在“摘要”选项卡中更改因子数量并重新估计,full_factor_ui.R
2 dimensions,二维,mds_ui.R
3 dimensions,三维,mds_ui.R
metric,度量型,mds_ui.R
non-metric,非度量型,mds_ui.R
Multivariate > Maps,多元分析 > 映射,mds_ui.R
(Dis)similarity,(不)相似性分析,"mds_ui.R,init.R"
Font size:,字体大小:,mds_ui.R
(Dis)similarity based brand maps (MDS),基于(不)相似性的感知图(MDS),mds_ui.R
Save MDS coordinates,保存 MDS 坐标,mds_ui.R
** Press the Estimate button to generate maps **,** 请点击“估计模型”按钮以生成地图 **,mds_ui.R
ID 1:,ID 1:,mds_ui.R
ID 2:,ID 2:,mds_ui.R
Dissimilarity:,相异度:,mds_ui.R
Generating MDS solution,正在生成 MDS 解,mds_ui.R
Save MDS plot,保存 MDS 图,mds_ui.R
Reverse:,反向:,mds_ui.R
Pre-factor,预因子分析,"pre_factor_ui.R,init.R"
Pre-factor analysis,预因子分析,pre_factor_ui.R
** Press the Estimate button to generate factor analysis diagnostics **,** 请点击“估计模型”按钮以生成因子分析诊断 **,pre_factor_ui.R
Save pre-factor plot,保存预因子图,pre_factor_ui.R
Please select two or more numeric variables,请选择两个或更多数值变量,pre_factor_ui.R
Loadings cutoff:,因子载荷阈值:,prmap_ui.R
Attribute scale:,指标刻度:,prmap_ui.R
Attribute based brand maps,基于指标的机构感知图,prmap_ui.R
** Press the Estimate button to generate perceptual maps **,** 点击“估计模型”按钮生成感知图 **,prmap_ui.R
Brand:,机构变量:,prmap_ui.R
"This analysis requires a brand variable of type factor or character and multiple attribute variables
of type numeric or integer. If these variables are not available please select another dataset.",本分析需要一个因子型或字符型的机构变量,以及多个数值型或整型的指标变量。\n如果数据集中不包含这些变量,请选择其他数据集。\n\n,prmap_ui.R
Save preceptual map plot,保存感知图,prmap_ui.R
Brands,机构,prmap_ui.R
Preferences:,偏好:,prmap_ui.R
Preferences,偏好,prmap_ui.R
Please select two or more attribute variables,请选择两个或更多属性变量,prmap_ui.R
Generating perceptual map,正在生成感知地图,prmap_ui.R
Generating brand maps,正在生成机构地图,prmap_ui.R
Share radiant state,分享Radiant状态,global.R
View radiant state,查看Radiant状态,global.R
Download radiant state file,下载Radiant状态文件,global.R
Upload radiant state file,上传Radiant状态文件,global.R
Stop,停止,global.R
Refresh,刷新,global.R
New session,新建会话,global.R
Videos,视频,global.R
About,关于,global.R
Radiant docs,Radiant文档,global.R
Report issue,报告问题,global.R
Design,设计,init.R
Sample,样本,init.R
Basics,基础,init.R
Probability,概率,init.R
Means,均值,init.R
Proportions,比例,init.R
Tables,表格,init.R
Estimate,估计,init.R
Trees,树模型,init.R
Evaluate regression,回归模型评估,init.R
Recommend,推荐,init.R
Decide,决策,init.R
Multivariate,多元分析,init.R
Maps,感知图,init.R
Attributes,属性分析,init.R
Cluster,聚类分析,init.R
Report,报告,"global.R,radiant.R"
Evaluate regressions,回归模型评估,evalreg_ui.R
Knit report (Rmd),编译报告 (Rmd),"report_rmd.R,report_r.R"
Knit report (R),编译报告 (R),"report_rmd.R,report_r.R"
Save report,保存报告,"report_rmd.R,report_r.R"
Load report,加载报告,"report_rmd.R,report_r.R"
Read files,读取文件,"report_rmd.R,report_r.R"
Clear output,清除输出,"report_rmd.R,report_r.R"
General,一般指令,help.R
Save state,保存状态文件,help.R
Open state,打开状态文件,help.R
Show help,显示帮助,help.R
Generate screenshot,生成截图,help.R
Generate code,生成代码,help.R
Estimate/Run (green button),估算/运行(绿色按钮),help.R
Save (blue button),保存(蓝色按钮),help.R
Download (blue icon),下载(蓝色图标),help.R
Load (blue button),加载(蓝色按钮),help.R
Radiant for R,医学科研统计工具,"global.R,ui.R"
Base dir:,根目录:,global.R
Generate descriptive statistics with one click,一键生成描述性统计,"quickgen_basic_ui.R,init.R"
Oneclick generation > Generate descriptive statistics,一键生成 > 生成描述性统计,quickgen_basic_ui.R
Oneclick generation,一键生成,init.R
LLM generates descriptive statistics,大模型生成描述性统计,init.R
Select All,全选,quickgen_basic_ui.R
Deselect All,全不选,quickgen_basic_ui.R
Invert,反选,quickgen_basic_ui.R
Radiant screenshot,截图,radiant.R
Cancel,取消,radiant.R
Table,表格,quickgen_basic_ui.R
OneClick table generation,一键成表,quickgen_basic_ui.R
Select numeric variables,选择数值变量,quickgen_basic_ui.R
Chart,图表,quickgen_basic_ui.R
OneClick chart generation,一键生图,quickgen_basic_ui.R
Select Y variable(s),选择Y变量,quickgen_basic_ui.R
Select X variable(s),选择X变量,quickgen_basic_ui.R
No data available,暂无数据,quickgen_basic_ui.R
No numerical variable available,无可用数值变量,quickgen_basic_ui.R
### Current data overview,### 当前数据概况,quickgen_basic_ui.R
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/radiant.R
\name{launcher}
\alias{launcher}
\title{Create a launcher on the desktop for Windows (.bat), Mac (.command), or Linux (.sh)}
\usage{
launcher(
app = c("radiant", "radiant.data", "radiant.design", "radiant.basics", "radiant.model",
"radiant.multivariate"),
port = 4444,
pdir = Sys.getenv("HOME")
)
}
\arguments{
\item{app}{App to run when the desktop icon is double-clicked ("analytics", "marketing", "quant", or "base"). Default is "analytics"}
\item{port}{Port to use for shiny::runApp (e.g, port = 4444)}
\item{pdir}{Project directory to use. Default is Sys.getenv("HOME")}
}
\description{
Create a launcher on the desktop for Windows (.bat), Mac (.command), or Linux (.sh)
}
\details{
On Windows/Mac/Linux a file named radiant.bat/radiant.command/radiant.sh will be put on the desktop. Double-click the file to launch the specified Radiant app
}
\examples{
\dontrun{
radiant::launcher("radiant.model")
}
}
\seealso{
\code{\link{win_launcher}} to create a shortcut on Windows
\code{\link{mac_launcher}} to create a shortcut on Mac
\code{\link{lin_launcher}} to create a shortcut on Linux
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/radiant.R
\name{lin_launcher}
\alias{lin_launcher}
\title{Create a launcher and updater for Linux (.sh)}
\usage{
lin_launcher(
app = c("radiant", "radiant.data", "radiant.design", "radiant.basics", "radiant.model",
"radiant.multivariate"),
port = 4444,
pdir = Sys.getenv("HOME")
)
}
\arguments{
\item{app}{App to run when the desktop icon is double-clicked ("radiant", "radiant.data", etc.). Default is "radiant"}
\item{port}{Port to use for shiny::runApp (e.g, port = 4444)}
\item{pdir}{Project directory to use. Default is Sys.getenv("HOME")}
}
\description{
Create a launcher and updater for Linux (.sh)
}
\details{
On Linux a file named 'radiant.sh' and one named 'update_radiant.sh' will be put on the desktop. Double-click the file to launch the specified Radiant app or update Radiant to the latest version
}
\examples{
\dontrun{
radiant::lin_launcher("radiant")
}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/radiant.R
\name{mac_launcher}
\alias{mac_launcher}
\title{Create a launcher and updater for Mac (.command)}
\usage{
mac_launcher(
app = c("radiant", "radiant.data", "radiant.design", "radiant.basics", "radiant.model",
"radiant.multivariate"),
port = 4444,
pdir = Sys.getenv("HOME")
)
}
\arguments{
\item{app}{App to run when the desktop icon is double-clicked ("radiant", "radiant.data", etc.). Default is "radiant"}
\item{port}{Port to use for shiny::runApp (e.g, port = 4444)}
\item{pdir}{Project directory to use. Default is Sys.getenv("HOME")}
}
\description{
Create a launcher and updater for Mac (.command)
}
\details{
On Mac a file named 'radiant.command' and one named 'update_radiant.command' will be put on the desktop. Double-click the file to launch the specified Radiant app or update Radiant to the latest version
}
\examples{
\dontrun{
radiant::mac_launcher()
}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/aaa.R, R/radiant.R
\name{radiant}
\alias{radiant}
\title{radiant}
\usage{
radiant(state, ...)
}
\arguments{
\item{state}{Path to state file to load}
\item{...}{additional arguments to pass to shiny::runApp (e.g, port = 8080)}
}
\description{
Launch radiant in the default web browser
}
\details{
See \url{https://radiant-rstats.github.io/docs/} for documentation and tutorials
}
\examples{
\dontrun{
radiant()
radiant("https://github.com/radiant-rstats/docs/raw/gh-pages/examples/demo-dvd-rnd.state.rda")
}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/radiant.R
\name{radiant_url}
\alias{radiant_url}
\title{Start radiant but do not open a browser}
\usage{
radiant_url(state, ...)
}
\arguments{
\item{state}{Path to statefile to load}
\item{...}{additional arguments to pass to shiny::runApp (e.g, port = 8080)}
}
\description{
Start radiant but do not open a browser
}
\examples{
\dontrun{
radiant_url()
}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/radiant.R
\name{radiant_viewer}
\alias{radiant_viewer}
\title{Launch radiant in the Rstudio viewer}
\usage{
radiant_viewer(state, ...)
}
\arguments{
\item{state}{Path to state file to load}
\item{...}{additional arguments to pass to shiny::runApp (e.g, port = 8080)}
}
\description{
Launch radiant in the Rstudio viewer
}
\details{
See \url{https://radiant-rstats.github.io/docs/} for documentation and tutorials
}
\examples{
\dontrun{
radiant_viewer()
}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/radiant.R
\name{radiant_window}
\alias{radiant_window}
\title{Launch radiant in an Rstudio window}
\usage{
radiant_window(state, ...)
}
\arguments{
\item{state}{Path to state file to load}
\item{...}{additional arguments to pass to shiny::runApp (e.g, port = 8080)}
}
\description{
Launch radiant in an Rstudio window
}
\details{
See \url{https://radiant-rstats.github.io/docs/} for documentation and tutorials
}
\examples{
\dontrun{
radiant_window()
}
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/radiant.R
\name{win_launcher}
\alias{win_launcher}
\title{Create a launcher and updater for Windows (.bat)}
\usage{
win_launcher(
app = c("radiant", "radiant.data", "radiant.design", "radiant.basics", "radiant.model",
"radiant.multivariate"),
port = 4444,
pdir = Sys.getenv("HOME")
)
}
\arguments{
\item{app}{App to run when the desktop icon is double-clicked ("radiant", "radiant.data", etc.). Default is "radiant"}
\item{port}{Port to use for shiny::runApp (e.g, port = 4444)}
\item{pdir}{Project directory to use. Default is Sys.getenv("HOME")}
}
\description{
Create a launcher and updater for Windows (.bat)
}
\details{
On Windows a file named 'radiant.bat' and one named 'update_radiant.bat' will be put on the desktop. Double-click the file to launch the specified Radiant app or update Radiant to the latest version
}
\examples{
\dontrun{
radiant::win_launcher()
}
}
## use shift-cmd-t to run all tests
library(testthat)
test_check("radiant")
context("Installed")
test_that("radiant.data", {
expect_true("radiant.data" %in% installed.packages())
})
test_that("radiant.design", {
expect_true("radiant.design" %in% installed.packages())
})
test_that("radiant.basics", {
expect_true("radiant.basics" %in% installed.packages())
})
test_that("radiant.model", {
expect_true("radiant.model" %in% installed.packages())
})
test_that("radiant.multivariate", {
expect_true("radiant.multivariate" %in% installed.packages())
})
&copy; Vincent Nijs (2023) <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank"><img alt="Creative Commons License" style="border-width: 0" src="./images/by-sa.png"/></a>
## ----r_setup, include = FALSE-----------------------------------------------------------------------------------------------------------------------
library(radiant)
knitr::opts_chunk$set(
comment = NA,
cache = FALSE,
message = FALSE,
warning = FALSE,
dpi = 96
)
options(width = 150)
## ----single_mean_price, fig.height = 3, fig.width = 5-----------------------------------------------------------------------------------------------
library(radiant)
data(diamonds, envir = environment())
result <- single_mean(diamonds, "price")
summary(result)
plot(result)
## ----scatter, fig.height = 4, fig.width = 5---------------------------------------------------------------------------------------------------------
visualize(
diamonds,
xvar = "carat",
yvar = "price",
type = "scatter",
facet_row = "clarity",
color = "clarity",
labs = labs(title = "Diamond Prices ($)"),
custom = FALSE
)
## ----single_mean_mpg, fig.height = 3, fig.width = 5-------------------------------------------------------------------------------------------------
result <- single_mean(
mtcars,
var = "mpg",
comp_value = 20,
alternative = "greater"
)
summary(result)
plot(result, plots = "hist")
## ----compare_means_diamonds, fig.height = 5, fig.width = 4------------------------------------------------------------------------------------------
result <- compare_means(
diamonds,
var1 = "clarity",
var2 = "price",
adjust = "bonf"
)
summary(result)
plot(result, plots = c("bar", "density"))
## ----eval = FALSE-----------------------------------------------------------------------------------------------------------------------------------
# ## start radiant in Rstudio, load the example data, then click the power
# ## icon in the navigation bar and click on Stop
# radiant::radiant()
## ----compare_means_salary, fig.height = 3, fig.width = 4--------------------------------------------------------------------------------------------
result <- compare_means(salary, var1 = "rank", var2 = "salary")
summary(result)
plot(result)
## ---------------------------------------------------------------------------------------------------------------------------------------------------
result <- regress(diamonds, rvar = "price", evar = c("carat","clarity"))
summary(result, sum_check = "confint")
pred <- predict(result, pred_cmd = "carat = 1:10")
print(pred, n = 10)
## ----regress_coeff, fig.width = 6, fig.height = 4---------------------------------------------------------------------------------------------------
plot(result, plots = "coef")
## ----regress_dashboard, fig.width = 5, fig.height = 7-----------------------------------------------------------------------------------------------
plot(result, plots = "dashboard", lines = "line", nrobs = 100)
## ----hclus, fig.width = 4, fig.height = 5-----------------------------------------------------------------------------------------------------------
## run hierarchical cluster analysis on the shopping data, variables v1 through v6
result <- hclus(shopping, "v1:v6")
## summary - not much here - plots are more important
summary(result)
## check the help file on how to plot results from hierarchical cluster
## analysis default plots
## it looks like there is a big jump in overall within-cluster
## heterogeneity in the step from 3 to 2 segments
plot(result)
## ----dendro, fig.width = 4, fig.height = 5----------------------------------------------------------------------------------------------------------
## show the dendrogram with cutoff at 0.05
plot(result, plots = "dendro", cutoff = 0.05)
## ----kclus, fig.width = 5, fig.height = 6-----------------------------------------------------------------------------------------------------------
## plots created above suggest 3 clusters may be most appropriate
## use kclus to create the clusters
## generate output and store cluster membership
result <- kclus(shopping, vars = "v1:v6", nr_clus = 3)
summary(result)
plot(result, plots = c("density", "bar"))
shopping <- store(shopping, result, name = "clus")
## was the data really changed?
head(as.data.frame(shopping))
---
title: Programming with Radiant
author: "Vincent R. Nijs, Rady School of Management (UCSD)"
date: "`r Sys.Date()`"
output:
rmarkdown::html_vignette:
pandoc_args: ["--css", "https://use.fontawesome.com/releases/v5.15.3/css/all.css"]
vignette: >
%\VignetteIndexEntry{Programming with Radiant}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
```{r r_setup, include = FALSE}
library(radiant)
knitr::opts_chunk$set(
comment = NA,
cache = FALSE,
message = FALSE,
warning = FALSE,
dpi = 96
)
options(width = 150)
```
Radiant's goal is to provide access to the power of R for business analytics and data science. Although Radiant's web-interface can handle many data and analysis tasks, you may prefer to write your own code. Radiant provides a bridge to programming in R(studio) by exporting the functions used for analysis. For example, you can run your analyses in Radiant and output the relevant function calls to an R or [Rmarkdown](https://rmarkdown.rstudio.com/) document. Most pages in the app have an <i title='Report results' class='fa fa-edit'></i> icon on the bottom left of your screen that you can click to generate a (reproducible) report with your analysis in the _Report > Rmd_ (or _Report > R_) tab. As an alternative to clicking the <i title='Report results' class='fa fa-edit'></i> icon you can also press `ALT-enter` on your keyboard. Click the `Knit report` button on the _Report > Rmd_ page to render the report to HTML or press the `Save report` button to produce a Notebook, HTML, PDF, Word, or Rmarkdown file. Radiant's function manuals can be viewed using the commands below:
```r
help(package = radiant.data)
help(package = radiant.design)
help(package = radiant.basics)
help(package = radiant.model)
help(package = radiant.multivariate)
```
You can also use Rstudio to render and edit Rmarkdown documents generated in Radiant. When you install and load Radiant it exports functions that can be called from R-code and/or an Rmarkdown document. For example, you can paste the commands below into the command console to get the same output as in the browser interface.
```{r single_mean_price, fig.height = 3, fig.width = 5}
library(radiant)
data(diamonds, envir = environment())
result <- single_mean(diamonds, "price")
summary(result)
plot(result)
```
You can also call functions for visualization (see below) and access help from the console using `?visualize`
```{r scatter, fig.height = 4, fig.width = 5}
visualize(
diamonds,
xvar = "carat",
yvar = "price",
type = "scatter",
facet_row = "clarity",
color = "clarity",
labs = labs(title = "Diamond Prices ($)"),
custom = FALSE
)
```
Use `library(radiant)` to load the library. To see the index of functions currently available in, for example, Radiant's Model menu use the `help(package = "radiant.model")` command
Lets start by comparing the mean of a variable to a (population) value using R's built-in `mtcars` dataset. This functionality is in the Radiant menu _Basics > Means > Single mean_. The analysis is conducted in function `single_mean`. Calling the `summary` method on the result object will show tabular output. Calling `plot` on the same result object will produce relevant plots.
```{r single_mean_mpg, fig.height = 3, fig.width = 5}
result <- single_mean(
mtcars,
var = "mpg",
comp_value = 20,
alternative = "greater"
)
summary(result)
plot(result, plots = "hist")
```
To compare the mean price of diamonds across different levels of clarity we can call the `compare_means` function:
```{r compare_means_diamonds, fig.height = 5, fig.width = 4}
result <- compare_means(
diamonds,
var1 = "clarity",
var2 = "price",
adjust = "bonf"
)
summary(result)
plot(result, plots = c("bar", "density"))
```
These datasets are available after loading the radiant library by using the `data` function. We can also load data through Radiant's browser interface and then access the data from the console after closing the app. Start radiant using the command below and then click select `Examples` from the `Load data of type` dropdown in the _Data > Manage_ tab. Then close the app by clicking the <i title='Power off' class='fa fa-power-off'></i> icon in the navbar and then clicking `Stop`. The datasets loaded through the web-interface are now available in the `r_data` environment as well. To use them directly in your code use `attach(r_data)`.
```{r eval = FALSE}
## start radiant in Rstudio, load the example data, then click the power
## icon in the navigation bar and click on Stop
radiant::radiant()
```
Because we already loaded the radiant library we already have access to all the data we need here. Lets use the `compare_means` function to evaluate salary data for professors of different ranks using:
```{r compare_means_salary, fig.height = 3, fig.width = 4}
result <- compare_means(salary, var1 = "rank", var2 = "salary")
summary(result)
plot(result)
```
We can also run regressions and get output in a format that would require quite a few lines of code to produce from scratch:
```{r}
result <- regress(diamonds, rvar = "price", evar = c("carat","clarity"))
summary(result, sum_check = "confint")
pred <- predict(result, pred_cmd = "carat = 1:10")
print(pred, n = 10)
```
```{r regress_coeff, fig.width = 6, fig.height = 4}
plot(result, plots = "coef")
```
```{r regress_dashboard, fig.width = 5, fig.height = 7}
plot(result, plots = "dashboard", lines = "line", nrobs = 100)
```
As another example, imagine that you want to segment a sample of respondents based on their toothpaste attitudes. Below is the required code to produce results using functions from the Radiant package. For help on the commands and options for cluster analysis use `?hclus`, `?plot.hclus`, and `?klus`. See also the Radiant function manuals linked above.
```{r hclus, fig.width = 4, fig.height = 5}
## run hierarchical cluster analysis on the shopping data, variables v1 through v6
result <- hclus(shopping, "v1:v6")
## summary - not much here - plots are more important
summary(result)
## check the help file on how to plot results from hierarchical cluster
## analysis default plots
## it looks like there is a big jump in overall within-cluster
## heterogeneity in the step from 3 to 2 segments
plot(result)
```
```{r dendro, fig.width = 4, fig.height = 5}
## show the dendrogram with cutoff at 0.05
plot(result, plots = "dendro", cutoff = 0.05)
```
```{r kclus, fig.width = 5, fig.height = 6}
## plots created above suggest 3 clusters may be most appropriate
## use kclus to create the clusters
## generate output and store cluster membership
result <- kclus(shopping, vars = "v1:v6", nr_clus = 3)
summary(result)
plot(result, plots = c("density", "bar"))
shopping <- store(shopping, result, name = "clus")
## was the data really changed?
head(as.data.frame(shopping))
```
See if you can reproduce this output in the radiant browser interface. Start `Radiant` from the `Addins` dropdown in Rstudio.
```{r child = "_footer.md"}
```
radiant.basics @ aa8ac245
Subproject commit aa8ac2453a67479c8f5d5e1aa39f77ce1770d5b5
radiant.data @ b42fc2a2
Subproject commit b42fc2a29c1ddbf1e98584d0164d8c22b174bb8b
radiant.design @ cf1e8d01
Subproject commit cf1e8d01e73194550af45c55232b58b86a47ba1b
radiant.model @ 347a11b7
Subproject commit 347a11b712eb2fdcc77ca05313ff4eb8e74deb3d
Subproject commit 08adce285a9cfe5106a2d397d890e9eb98451ce9
{
"sortOrder": [
{
"columnIndex": 2,
"ascending": true
}
],
"path": "D:/R"
}
\ No newline at end of file
{
"activeTab": 2
}
\ No newline at end of file
{
"left": {
"splitterpos": 312,
"topwindowstate": "NORMAL",
"panelheight": 826,
"windowheight": 864
},
"right": {
"splitterpos": 518,
"topwindowstate": "NORMAL",
"panelheight": 826,
"windowheight": 864
}
}
\ No newline at end of file
{
"TabSet1": 0,
"TabSet2": 0,
"TabZoom": {}
}
\ No newline at end of file
{"active_set":"","sets":[]}
\ No newline at end of file
{
"id": "37A6706B",
"path": "D:/R/radiant.quickgen/R/quickgen_basic.R",
"project_path": "R/quickgen_basic.R",
"type": "r_source",
"hash": "2601472834",
"contents": "",
"dirty": false,
"created": 1756092822912.0,
"source_on_save": false,
"relative_order": 2,
"properties": {
"source_window_id": "",
"Source": "Source",
"cursorPosition": "18,40",
"scrollLine": "0"
},
"folds": "",
"lastKnownWriteTime": 1756087288,
"encoding": "UTF-8",
"collab_server": "",
"source_window": "",
"last_content_update": 1756087288,
"read_only": false,
"read_only_alternatives": []
}
\ No newline at end of file
explore <- function(dataset, vars = "", byvar = "", fun = c("mean", "sd"),
top = "fun", tabfilt = "", tabsort = "", tabslice = "",
nr = Inf, data_filter = "", arr = "", rows = NULL,
envir = parent.frame()) {
tvars <- vars
if (!is.empty(byvar)) tvars <- unique(c(tvars, byvar))
df_name <- if (is_string(dataset)) dataset else deparse(substitute(dataset))
dataset <- get_data(dataset, tvars, filt = data_filter, arr = arr, rows = rows, na.rm = FALSE, envir = envir)
rm(tvars)
## in case : was used
vars <- base::setdiff(colnames(dataset), byvar)
## converting data as needed for summarization
dc <- get_class(dataset)
fixer <- function(x, fun = as_integer) {
if (is.character(x) || is.Date(x)) {
x <- rep(NA, length(x))
} else if (is.factor(x)) {
x_num <- sshhr(as.integer(as.character(x)))
if (length(na.omit(x_num)) == 0) {
x <- fun(x)
} else {
x <- x_num
}
}
x
}
fixer_first <- function(x) {
x <- fixer(x, function(x) as_integer(x == levels(x)[1]))
}
mean <- function(x, na.rm = TRUE) sshhr(base::mean(fixer_first(x), na.rm = na.rm))
sum <- function(x, na.rm = TRUE) sshhr(base::sum(fixer_first(x), na.rm = na.rm))
var <- function(x, na.rm = TRUE) sshhr(stats::var(fixer_first(x), na.rm = na.rm))
sd <- function(x, na.rm = TRUE) sshhr(stats::sd(fixer_first(x), na.rm = na.rm))
se <- function(x, na.rm = TRUE) sshhr(radiant.data::se(fixer_first(x), na.rm = na.rm))
me <- function(x, na.rm = TRUE) sshhr(radiant.data::me(fixer_first(x), na.rm = na.rm))
cv <- function(x, na.rm = TRUE) sshhr(radiant.data::cv(fixer_first(x), na.rm = na.rm))
prop <- function(x, na.rm = TRUE) sshhr(radiant.data::prop(fixer_first(x), na.rm = na.rm))
varprop <- function(x, na.rm = TRUE) sshhr(radiant.data::varprop(fixer_first(x), na.rm = na.rm))
sdprop <- function(x, na.rm = TRUE) sshhr(radiant.data::sdprop(fixer_first(x), na.rm = na.rm))
seprop <- function(x, na.rm = TRUE) sshhr(radiant.data::seprop(fixer_first(x), na.rm = na.rm))
meprop <- function(x, na.rm = TRUE) sshhr(radiant.data::meprop(fixer_first(x), na.rm = na.rm))
varpop <- function(x, na.rm = TRUE) sshhr(radiant.data::varpop(fixer_first(x), na.rm = na.rm))
sdpop <- function(x, na.rm = TRUE) sshhr(radiant.data::sdpop(fixer_first(x), na.rm = na.rm))
median <- function(x, na.rm = TRUE) sshhr(stats::median(fixer(x), na.rm = na.rm))
min <- function(x, na.rm = TRUE) sshhr(base::min(fixer(x), na.rm = na.rm))
max <- function(x, na.rm = TRUE) sshhr(base::max(fixer(x), na.rm = na.rm))
p01 <- function(x, na.rm = TRUE) sshhr(radiant.data::p01(fixer(x), na.rm = na.rm))
p025 <- function(x, na.rm = TRUE) sshhr(radiant.data::p025(fixer(x), na.rm = na.rm))
p05 <- function(x, na.rm = TRUE) sshhr(radiant.data::p05(fixer(x), na.rm = na.rm))
p10 <- function(x, na.rm = TRUE) sshhr(radiant.data::p10(fixer(x), na.rm = na.rm))
p25 <- function(x, na.rm = TRUE) sshhr(radiant.data::p25(fixer(x), na.rm = na.rm))
p75 <- function(x, na.rm = TRUE) sshhr(radiant.data::p75(fixer(x), na.rm = na.rm))
p90 <- function(x, na.rm = TRUE) sshhr(radiant.data::p90(fixer(x), na.rm = na.rm))
p95 <- function(x, na.rm = TRUE) sshhr(radiant.data::p95(fixer(x), na.rm = na.rm))
p975 <- function(x, na.rm = TRUE) sshhr(radiant.data::p975(fixer(x), na.rm = na.rm))
p99 <- function(x, na.rm = TRUE) sshhr(radiant.data::p99(fixer(x), na.rm = na.rm))
skew <- function(x, na.rm = TRUE) sshhr(radiant.data::skew(fixer(x), na.rm = na.rm))
kurtosi <- function(x, na.rm = TRUE) sshhr(radiant.data::kurtosi(fixer(x), na.rm = na.rm))
isLogNum <- "logical" == dc & names(dc) %in% base::setdiff(vars, byvar)
if (sum(isLogNum) > 0) {
dataset[, isLogNum] <- select(dataset, which(isLogNum)) %>%
mutate_all(as.integer)
dc[isLogNum] <- "integer"
}
if (is.empty(byvar)) {
byvar <- c()
tab <- summarise_all(dataset, fun, na.rm = TRUE)
} else {
## convert categorical variables to factors if needed
## needed to deal with empty/missing values
dataset[, byvar] <- select_at(dataset, .vars = byvar) %>%
mutate_all(~ empty_level(.))
tab <- dataset %>%
group_by_at(.vars = byvar) %>%
summarise_all(fun, na.rm = TRUE)
}
## adjust column names
if (length(vars) == 1 || length(fun) == 1) {
rng <- (length(byvar) + 1):ncol(tab)
colnames(tab)[rng] <- paste0(vars, "_", fun)
rm(rng)
}
## setup regular expression to split variable/function column appropriately
rex <- paste0("(.*?)_", glue('({glue_collapse(fun, "$|")}$)'))
## useful answer and comments: http://stackoverflow.com/a/27880388/1974918
tab <- gather(tab, "variable", "value", !!-(seq_along(byvar))) %>%
extract(variable, into = c("variable", "fun"), regex = rex) %>%
mutate(fun = factor(fun, levels = !!fun), variable = factor(variable, levels = vars)) %>%
# mutate(variable = paste0(variable, " {", dc[variable], "}")) %>%
spread("fun", "value")
## flip the table if needed
if (top != "fun") {
tab <- list(tab = tab, byvar = byvar, fun = fun) %>%
flip(top)
}
nrow_tab <- nrow(tab)
## filtering the table if desired from Report > Rmd
if (!is.empty(tabfilt)) {
tab <- filter_data(tab, tabfilt)
}
## sorting the table if desired from Report > Rmd
if (!identical(tabsort, "")) {
tabsort <- gsub(",", ";", tabsort)
tab <- tab %>% arrange(!!!rlang::parse_exprs(tabsort))
}
## ensure factors ordered as in the (sorted) table
if (!is.empty(byvar) && top != "byvar") {
for (i in byvar) tab[[i]] <- tab[[i]] %>% (function(x) factor(x, levels = unique(x)))
rm(i)
}
## frequencies converted to doubles during gather/spread above
check_int <- function(x) {
if (is.double(x) && length(na.omit(x)) > 0) {
x_int <- sshhr(as.integer(round(x, .Machine$double.rounding)))
if (isTRUE(all.equal(x, x_int, check.attributes = FALSE))) x_int else x
} else {
x
}
}
tab <- ungroup(tab) %>% mutate_all(check_int)
## slicing the table if desired
if (!is.empty(tabslice)) {
tab <- tab %>%
slice_data(tabslice) %>%
droplevels()
}
## convert to data.frame to maintain attributes
tab <- as.data.frame(tab, stringsAsFactors = FALSE)
attr(tab, "radiant_nrow") <- nrow_tab
if (!isTRUE(is.infinite(nr))) {
ind <- if (nr > nrow(tab)) 1:nrow(tab) else 1:nr
tab <- tab[ind, , drop = FALSE]
rm(ind)
}
list(
tab = tab,
df_name = df_name,
vars = vars,
byvar = byvar,
fun = fun,
top = top,
tabfilt = tabfilt,
tabsort = tabsort,
tabslice = tabslice,
nr = nr,
data_filter = data_filter,
arr = arr,
rows = rows
) %>% add_class("explore")
}
summary.explore <- function(object, dec = 3, ...) {
cat("Explore\n")
cat("Data :", object$df_name, "\n")
if (!is.empty(object$data_filter)) {
cat("Filter :", gsub("\\n", "", object$data_filter), "\n")
}
if (!is.empty(object$arr)) {
cat("Arrange :", gsub("\\n", "", object$arr), "\n")
}
if (!is.empty(object$rows)) {
cat("Slice :", gsub("\\n", "", object$rows), "\n")
}
if (!is.empty(object$tabfilt)) {
cat("Table filter:", object$tabfilt, "\n")
}
if (!is.empty(object$tabsort[1])) {
cat("Table sorted:", paste0(object$tabsort, collapse = ", "), "\n")
}
if (!is.empty(object$tabslice)) {
cat("Table slice :", object$tabslice, "\n")
}
nr <- attr(object$tab, "radiant_nrow")
if (!isTRUE(is.infinite(nr)) && !isTRUE(is.infinite(object$nr)) && object$nr < nr) {
cat(paste0("Rows shown : ", object$nr, " (out of ", nr, ")\n"))
}
if (!is.empty(object$byvar[1])) {
cat("Grouped by :", object$byvar, "\n")
}
cat("Functions :", paste0(object$fun, collapse = ", "), "\n")
cat("Top :", c("fun" = "Function", "var" = "Variables", "byvar" = "Group by")[object$top], "\n")
cat("\n")
format_df(object$tab, dec = dec, mark = ",") %>%
print(row.names = FALSE)
invisible()
}
store.explore <- function(dataset, object, name, ...) {
if (missing(name)) {
object$tab
} else {
stop(
paste0(
"This function is deprecated. Use the code below instead:\n\n",
name, " <- ", deparse(substitute(object)), "$tab\nregister(\"",
name, ")"
),
call. = FALSE
)
}
}
flip <- function(expl, top = "fun") {
cvars <- expl$byvar %>%
(function(x) if (is.empty(x[1])) character(0) else x)
if (top[1] == "var") {
expl$tab %<>% gather(".function", "value", !!-(1:(length(cvars) + 1))) %>%
spread("variable", "value")
expl$tab[[".function"]] %<>% factor(., levels = expl$fun)
} else if (top[1] == "byvar" && length(cvars) > 0) {
expl$tab %<>% gather(".function", "value", !!-(1:(length(cvars) + 1))) %>%
spread(!!cvars[1], "value")
expl$tab[[".function"]] %<>% factor(., levels = expl$fun)
## ensure we don't have invalid column names
colnames(expl$tab) <- fix_names(colnames(expl$tab))
}
expl$tab
}
dtab.explore <- function(object, dec = 3, searchCols = NULL,
order = NULL, pageLength = NULL,
caption = NULL, ...) {
style <- if (exists("bslib_current_version") && "4" %in% bslib_current_version()) "bootstrap4" else "bootstrap"
tab <- object$tab
cn_all <- colnames(tab)
cn_num <- cn_all[sapply(tab, is.numeric)]
cn_cat <- cn_all[-which(cn_all %in% cn_num)]
isInt <- sapply(tab, is.integer)
isDbl <- sapply(tab, is_double)
dec <- ifelse(is.empty(dec) || dec < 0, 3, round(dec, 0))
top <- c("fun" = "Function", "var" = "Variables", "byvar" = paste0("Group by: ", object$byvar[1]))[object$top]
sketch <- shiny::withTags(
table(
thead(
tr(
th(" ", colspan = length(cn_cat)),
lapply(top, th, colspan = length(cn_num), class = "text-center")
),
tr(lapply(cn_all, th))
)
)
)
if (!is.empty(caption)) {
## from https://github.com/rstudio/DT/issues/630#issuecomment-461191378
caption <- shiny::tags$caption(style = "caption-side: bottom; text-align: left; font-size:100%;", caption)
}
## for display options see https://datatables.net/reference/option/dom
dom <- if (nrow(tab) < 11) "t" else "ltip"
fbox <- if (nrow(tab) > 5e6) "none" else list(position = "top")
dt_tab <- DT::datatable(
tab,
container = sketch,
caption = caption,
selection = "none",
rownames = FALSE,
filter = fbox,
## must use fillContainer = FALSE to address
## see https://github.com/rstudio/DT/issues/367
## https://github.com/rstudio/DT/issues/379
fillContainer = FALSE,
style = style,
options = list(
dom = dom,
stateSave = TRUE, ## store state
searchCols = searchCols,
order = order,
columnDefs = list(list(orderSequence = c("desc", "asc"), targets = "_all")),
autoWidth = TRUE,
processing = FALSE,
pageLength = {
if (is.null(pageLength)) 10 else pageLength
},
lengthMenu = list(c(5, 10, 25, 50, -1), c("5", "10", "25", "50", "All"))
),
## https://github.com/rstudio/DT/issues/146#issuecomment-534319155
callback = DT::JS('$(window).on("unload", function() { table.state.clear(); })')
) %>%
DT::formatStyle(., cn_cat, color = "white", backgroundColor = "grey")
## rounding as needed
if (sum(isDbl) > 0) {
dt_tab <- DT::formatRound(dt_tab, names(isDbl)[isDbl], dec)
}
if (sum(isInt) > 0) {
dt_tab <- DT::formatRound(dt_tab, names(isInt)[isInt], 0)
}
## see https://github.com/yihui/knitr/issues/1198
dt_tab$dependencies <- c(
list(rmarkdown::html_dependency_bootstrap("bootstrap")),
dt_tab$dependencies
)
dt_tab
}
###########################################
## turn functions below into functional ...
###########################################
n_obs <- function(x, ...) length(x)
n_missing <- function(x, ...) sum(is.na(x))
p01 <- function(x, na.rm = TRUE) quantile(x, .01, na.rm = na.rm)
p025 <- function(x, na.rm = TRUE) quantile(x, .025, na.rm = na.rm)
p05 <- function(x, na.rm = TRUE) quantile(x, .05, na.rm = na.rm)
p10 <- function(x, na.rm = TRUE) quantile(x, .1, na.rm = na.rm)
p25 <- function(x, na.rm = TRUE) quantile(x, .25, na.rm = na.rm)
p75 <- function(x, na.rm = TRUE) quantile(x, .75, na.rm = na.rm)
p90 <- function(x, na.rm = TRUE) quantile(x, .90, na.rm = na.rm)
p95 <- function(x, na.rm = TRUE) quantile(x, .95, na.rm = na.rm)
p975 <- function(x, na.rm = TRUE) quantile(x, .975, na.rm = na.rm)
p99 <- function(x, na.rm = TRUE) quantile(x, .99, na.rm = na.rm)
cv <- function(x, na.rm = TRUE) {
m <- mean(x, na.rm = na.rm)
if (m == 0) {
message("Mean should be greater than 0")
NA
} else {
sd(x, na.rm = na.rm) / m
}
}
se <- function(x, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
sd(x) / sqrt(length(x))
}
me <- function(x, conf_lev = 0.95, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
se(x) * qt(conf_lev / 2 + .5, length(x) - 1, lower.tail = TRUE)
}
prop <- function(x, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
if (is.numeric(x)) {
mean(x == max(x, 1)) ## gives proportion of max value in x
} else if (is.factor(x)) {
mean(x == levels(x)[1]) ## gives proportion of first level in x
} else if (is.logical(x)) {
mean(x)
} else {
NA
}
}
varprop <- function(x, na.rm = TRUE) {
p <- prop(x, na.rm = na.rm)
p * (1 - p)
}
sdprop <- function(x, na.rm = TRUE) sqrt(varprop(x, na.rm = na.rm))
seprop <- function(x, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
sqrt(varprop(x, na.rm = FALSE) / length(x))
}
meprop <- function(x, conf_lev = 0.95, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
seprop(x) * qnorm(conf_lev / 2 + .5, lower.tail = TRUE)
}
varpop <- function(x, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
n <- length(x)
var(x) * ((n - 1) / n)
}
sdpop <- function(x, na.rm = TRUE) sqrt(varpop(x, na.rm = na.rm))
ln <- function(x, na.rm = TRUE) {
if (na.rm) log(na.omit(x)) else log(x)
}
does_vary <- function(x, na.rm = TRUE) {
## based on http://stackoverflow.com/questions/4752275/test-for-equality-among-all-elements-of-a-single-vector
if (length(x) == 1L) {
FALSE
} else {
if (is.factor(x) || is.character(x)) {
length(unique(x)) > 1
} else {
abs(max(x, na.rm = na.rm) - min(x, na.rm = na.rm)) > .Machine$double.eps^0.5
}
}
}
empty_level <- function(x) {
if (!is.factor(x)) x <- as.factor(x)
levs <- levels(x)
if ("" %in% levs) {
levs[levs == ""] <- "NA"
x <- factor(x, levels = levs)
x[is.na(x)] <- "NA"
} else if (any(is.na(x))) {
x <- factor(x, levels = unique(c(levs, "NA")))
x[is.na(x)] <- "NA"
}
x
}
modal <- function(x, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
unv <- unique(x)
unv[which.max(tabulate(match(x, unv)))]
}
{
"id": "7DCB57AF",
"path": "D:/R/radiant-master/inst/app/global.R",
"project_path": null,
"type": "r_source",
"hash": "1707112965",
"contents": "",
"dirty": false,
"created": 1756093055069.0,
"source_on_save": false,
"relative_order": 3,
"properties": {
"source_window_id": "",
"Source": "Source",
"cursorPosition": "13,70",
"scrollLine": "0"
},
"folds": "",
"lastKnownWriteTime": 1755759383,
"encoding": "UTF-8",
"collab_server": "",
"source_window": "",
"last_content_update": 1755759383,
"read_only": false,
"read_only_alternatives": []
}
\ No newline at end of file
library(shiny.i18n)
i18n <- Translator$new(translation_csvs_path = "../translations")
i18n$set_translation_language("zh")
## sourcing from radiant.data
options(radiant.path.data = system.file(package = "radiant.data"))
source(file.path(getOption("radiant.path.data"), "app/global.R"), encoding = getOption("radiant.encoding", default = "UTF-8"), local = TRUE)
if (getOption("radiant.development", default = TRUE)) {
ifelse(grepl("radiant", getwd()) && file.exists("../../inst"), "..", system.file(package = "radiant")) %>%
options(radiant.path = .)
}
options(radiant.path.design = system.file(package = "radiant.design"))
options(radiant.path.basics = system.file(package = "radiant.basics"))
options(radiant.path.model = system.file(package = "radiant.model"))
options(radiant.path.multivariate = system.file(package = "radiant.multivariate"))
# 添加quickgen模块路径
options(radiant.path.quickgen = "D:/R/radiant.quickgen/inst")
# sourcing from radiant base, note that path is set in base/global.R
#source(file.path(getOption("radiant.path.data"), "app/global.R"), encoding = getOption("radiant.encoding", default = "UTF-8"), local = TRUE)
## setting path for figures in help files
addResourcePath("figures_design", file.path(getOption("radiant.path.design"), "app/tools/help/figures/"))
addResourcePath("figures_basics", file.path(getOption("radiant.path.basics"), "app/tools/help/figures/"))
addResourcePath("figures_model", file.path(getOption("radiant.path.model"), "app/tools/help/figures/"))
addResourcePath("figures_multivariate", file.path(getOption("radiant.path.multivariate"), "app/tools/help/figures/"))
# 添加quickgen模块的figures路径
addResourcePath("figures_quickgen", file.path(getOption("radiant.path.quickgen"), "app/tools/help/figures/"))
## setting path for www resources
addResourcePath("www_design", file.path(getOption("radiant.path.design"), "app/www/"))
addResourcePath("www_basics", file.path(getOption("radiant.path.basics"), "app/www/"))
addResourcePath("www_model", file.path(getOption("radiant.path.model"), "app/www/"))
addResourcePath("www_multivariate", file.path(getOption("radiant.path.multivariate"), "app/www/"))
# 添加quickgen模块的www路径
addResourcePath("www_quickgen", file.path(getOption("radiant.path.quickgen"), "app/www/"))
## loading url information
source(file.path(getOption("radiant.path.design"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
source(file.path(getOption("radiant.path.basics"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
source(file.path(getOption("radiant.path.model"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
source(file.path(getOption("radiant.path.multivariate"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
# 添加quickgen模块的init.R
source(file.path(getOption("radiant.path.quickgen"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
options(radiant.url.patterns = make_url_patterns())
if (!"package:radiant" %in% search() &&
isTRUE(getOption("radiant.development")) &&
getOption("radiant.path") == "..") {
options(radiant.from.package = FALSE)
} else {
options(radiant.from.package = TRUE)
}
## to use an alternative set of .rda files with data.frames as the default adapt and
## un-comment the line below
## note that "data/" here points to inst/app/data in the radiant directory but can
## be any (full) path on a server
# options(radiant.init.data = list.files(path = "data/", full.names = TRUE))
{
"id": "AC1E4C1F",
"path": "D:/R/radiant.quickgen/inst/app/tools/analysis/quickgen_basic_ui.R",
"project_path": "inst/app/tools/analysis/quickgen_basic_ui.R",
"type": "r_source",
"hash": "953623402",
"contents": "",
"dirty": false,
"created": 1756092786308.0,
"source_on_save": false,
"relative_order": 1,
"properties": {
"source_window_id": "",
"Source": "Source",
"cursorPosition": "15,2",
"scrollLine": "0"
},
"folds": "",
"lastKnownWriteTime": 1756090465,
"encoding": "UTF-8",
"collab_server": "",
"source_window": "",
"last_content_update": 1756090465,
"read_only": false,
"read_only_alternatives": []
}
\ No newline at end of file
## quickgen_basic 的形参列表
default_funs <- c("n_obs", "mean", "sd", "min", "max")
qgb_args <- as.list(formals(explore))
## 收集用户输入的 reactive 列表
qgb_inputs <- reactive({
qgb_args$data_filter <- if (input$show_filter) input$data_filter else ""
qgb_args$arr <- if (input$show_filter) input$data_arrange else ""
qgb_args$rows <- if (input$show_filter) input$data_rows else ""
qgb_args$dataset <- input$dataset
for (i in r_drop(names(qgb_args))) {
qgb_args[[i]] <- input[[paste0("qgb_", i)]]
}
qgb_args
})
qgb_sum_args <- as.list(if (exists("summary.explore")) {
formals(summary.explore)
} else {
formals(radiant.data:::summary.explore)
})
## list of function inputs selected by user
qgb_sum_inputs <- reactive({
## loop needed because reactive values don't allow single bracket indexing
for (i in names(qgb_sum_args)) {
qgb_sum_args[[i]] <- input[[paste0("qgb_", i)]]
}
qgb_sum_args
})
## UI-elements
output$ui_qgb_vars <- renderUI({
vars <- varnames()
req(available(vars))
selectInput(
"qgb_vars",
label = i18n$t("Numeric variable(s):"), choices = vars,
selected = state_multiple("qgb_vars", vars, isolate(input$qgb_vars)), multiple = TRUE,
size = min(8, length(vars)), selectize = FALSE
)
})
output$ui_qgb_byvar <- renderUI({
withProgress(message = i18n$t("Acquiring variable information"), value = 1, {
vars <- groupable_vars()
})
req(available(vars))
if (any(vars %in% input$qgb_vars)) {
vars <- base::setdiff(vars, input$qgb_vars)
names(vars) <- varnames() %>%
(function(x) x[match(vars, x)]) %>%
names()
}
isolate({
## if nothing is selected expl_byvar is also null
if ("qgb_byvar" %in% names(input) && is.null(input$qgb_byvar)) {
r_state$qgb_byvar <<- NULL
} else {
if (available(r_state$qgb_byvar) && all(r_state$qgb_byvar %in% vars)) {
vars <- unique(c(r_state$qgb_byvar, vars))
names(vars) <- varnames() %>%
(function(x) x[match(vars, x)]) %>%
names()
}
}
})
selectizeInput(
"qgb_byvar",
label = i18n$t("Group by:"), choices = vars,
selected = state_multiple("qgb_byvar", vars, isolate(input$qgb_byvar)),
multiple = TRUE,
options = list(
placeholder = i18n$t("Select group-by variable"),
plugins = list("remove_button", "drag_drop")
)
)
})
output$ui_qgb_fun <- renderUI({
r_funs <- getOption("radiant.functions")
selected <- isolate(
if (is.empty(input$qgb_fun)) default_funs else input$qgb_fun
)
checkboxGroupInput(
inputId = "qgb_fun",
label = i18n$t("Apply function(s):"),
choices = r_funs,
selected = selected
)
})
output$ui_qgb_top <- renderUI({
if (is.empty(input$qgb_vars)) {
return()
}
top_var <- setNames(
c("fun", "var", "byvar"),
c(i18n$t("Function"), i18n$t("Variables"), i18n$t("Group by"))
)
if (is.empty(input$qgb_byvar)) top_var <- top_var[1:2]
selectizeInput(
"qgb_top",
label = i18n$t("Column header:"),
choices = top_var,
selected = state_single("qgb_top", top_var, isolate(input$qgb_top)),
multiple = FALSE
)
})
output$ui_qgb_name <- renderUI({
req(input$dataset)
textInput("qgb_name", i18n$t("Store as:"), "", placeholder = i18n$t("Provide a table name"))
})
output$ui_qgb_run <- renderUI({
## updates when dataset changes
req(input$dataset)
actionButton("qgb_run", i18n$t("Create table"), width = "100%", icon = icon("play", verify_fa = FALSE), class = "btn-success")
})
## add a spinning refresh icon if the table needs to be (re)calculated
run_refresh(qgb_args, "qgb", init = "vars", label = i18n$t("Create table"), relabel = i18n$t("Update table"))
output$ui_quickgen_basic <- renderUI({
tagList(
wellPanel(
uiOutput("ui_qgb_run")
),
wellPanel(
uiOutput("ui_qgb_vars"),
uiOutput("ui_qgb_byvar"),
uiOutput("ui_qgb_fun"),
uiOutput("ui_qgb_top"),
# returnTextAreaInput("qgb_tab_slice",
# label = i18n$t("Table slice (rows):"),
# rows = 1,
# value = state_init("qgb_tab_slice"),
# placeholder = i18n$t("e.g., 1:5 and press return")
# ),
numericInput("qgb_dec", label = i18n$t("Decimals:"), value = state_init("qgb_dec", 3), min = 0)
),
wellPanel(
tags$table(
tags$td(uiOutput("ui_qgb_name")),
tags$td(actionButton("qgb_store", i18n$t("Store"), icon = icon("plus", verify_fa = FALSE)), class = "top")
)
),
help_and_report(
modal_title = i18n$t("Generate descriptive statistics with one click"), fun_name = "quickgen_basic",
help_file = inclMD(file.path(getOption("radiant.path.quickgen"), "app/tools/help/quickgen_basic.md")),
lic = "by-sa"
)
)
})
.explore <- eventReactive(input$qgb_run, {
if (not_available(input$qgb_vars) || is.null(input$qgb_top)) {
return()
} else if (!is.empty(input$qgb_byvar) && not_available(input$qgb_byvar)) {
return()
} else if (available(input$qgb_byvar) && any(input$qgb_byvar %in% input$qgb_vars)) {
return()
}
qgbi <- qgb_inputs()
qgbi$envir <- r_data
sshhr(do.call(explore, qgbi))
})
observeEvent(input$qgb_search_columns, {
r_state$qgb_search_columns <<- input$qgb_search_columns
})
observeEvent(input$qgb_state, {
r_state$qgb_state <<- input$qgb_state
})
qgb_reset <- function(var, ncol) {
if (!identical(r_state[[var]], input[[var]])) {
r_state[[var]] <<- input[[var]]
r_state$qgb_state <<- list()
r_state$qgb_search_columns <<- rep("", ncol)
}
}
output$explore <- DT::renderDataTable({
input$qgb_run
withProgress(message = i18n$t("Generating explore table"), value = 1, {
isolate({
qgb <- .explore()
req(!is.null(qgb))
qgb$shiny <- TRUE
## resetting DT when changes occur
nc <- ncol(qgb$tab)
qgb_reset("qgb_vars", nc)
qgb_reset("qgb_byvar", nc)
qgb_reset("qgb_fun", nc)
if (!is.null(r_state$qgb_top) &&
!is.null(input$qgb_top) &&
!identical(r_state$qgb_top, input$qgb_top)) {
r_state$qgb_top <<- input$qgb_top
r_state$qgb_state <<- list()
r_state$qgb_search_columns <<- rep("", nc)
}
searchCols <- lapply(r_state$qgb_search_columns, function(x) list(search = x))
order <- r_state$qgb_state$order
pageLength <- r_state$qgb_state$length
})
caption <- if (is.empty(input$qgb_tab_slice)) NULL else glue("Table slice {input$expl_tab_slice} will be applied on Download, Store, or Report")
dtab(
qgb,
dec = input$qgb_dec, searchCols = searchCols, order = order,
pageLength = pageLength,
caption = caption
)
})
})
dl_qgb_tab <- function(path) {
dat <- try(.explore(), silent = TRUE)
if (inherits(dat, "try-error") || is.null(dat)) {
write.csv(tibble::tibble("Data" = "[Empty]"), path, row.names = FALSE)
} else {
rows <- input$qgb_rows_all
dat$tab %>%
(function(x) if (is.null(rows)) x else x[rows, , drop = FALSE]) %>%
#(function(x) if (is.empty(input$qgb_tab_slice)) x else slice_data(x, input$qgb_tab_slice)) %>%
write.csv(path, row.names = FALSE)
}
}
download_handler(
id = "dl_qgb_tab",
fun = dl_qgb_tab,
fn = function() paste0(input$dataset, "_qgb"),
type = "csv"
)
observeEvent(input$qgb_store, {
req(input$qgb_name)
dat <- .explore()
if (is.null(dat)) {
return()
}
dataset <- fix_names(input$qgb_name)
if (input$qgb_name != dataset) {
updateTextInput(session, inputId = "qgb_name", value = dataset)
}
rows <- input$qgb_rows_all
dat$tab <- dat$tab %>%
(function(x) if (is.null(rows)) x else x[rows, , drop = FALSE]) %>%
#(function(x) if (is.empty(input$qgb_tab_slice)) x else slice_data(x, input$qgb_tab_slice))
r_data[[dataset]] <- dat$tab
register(dataset)
updateSelectInput(session, "dataset", selected = input$dataset)
showModal(
modalDialog(
title = i18n$t("Data Stored"),
span(
i18n$t("Dataset was successfully added to the datasets dropdown. Add code to Report > Rmd or Report > R to (re)create the results by clicking the report icon on the bottom left of your screen.")
),
footer = modalButton(i18n$t("OK")),
size = "m",
easyClose = TRUE
)
)
})
qgb_report <- function() {
## get the state of the dt table
ts <- dt_state("explore")
xcmd <- "# summary(result)\ndtab(result"
if (!is.empty(input$qgb_dec, 3)) {
xcmd <- paste0(xcmd, ", dec = ", input$qgb_dec)
}
if (!is.empty(r_state$qgb_state$length, 10)) {
xcmd <- paste0(xcmd, ", pageLength = ", r_state$qgb_state$length)
}
xcmd <- paste0(xcmd, ", caption = \"\") %>% render()")
if (!is.empty(input$qgb_name)) {
dataset <- fix_names(input$qgb_name)
if (input$qgb_name != dataset) {
updateTextInput(session, inputId = "qgb_name", value = dataset)
}
xcmd <- paste0(xcmd, "\n", dataset, " <- result$tab\nregister(\"", dataset, "\")")
}
inp_main <- clean_args(qgb_inputs(), qgb_args)
if (ts$tabsort != "") inp_main <- c(inp_main, tabsort = ts$tabsort)
if (ts$tabfilt != "") inp_main <- c(inp_main, tabfilt = ts$tabfilt)
if (is.empty(inp_main$rows)) {
inp_main$rows <- NULL
}
if (is.empty(input$qgb_tab_slice)) {
inp_main <- c(inp_main, nr = Inf)
} else {
inp_main$tabslice <- input$qgb_tab_slice
}
inp_out <- list(clean_args(qgb_sum_inputs(), qgb_sum_args[-1]))
update_report(
inp_main = inp_main,
fun_name = "qgb",
inp_out = inp_out,
outputs = c(),
figs = FALSE,
xcmd = xcmd
)
}
observeEvent(input$qgb_report, {
r_info[["latest_screenshot"]] <- NULL
qgb_report()
})
observeEvent(input$qgb_screenshot, {
r_info[["latest_screenshot"]] <- NULL
radiant_screenshot_modal("modal_qgb_screenshot")
})
observeEvent(input$modal_qgb_screenshot, {
qgb_report()
removeModal()
})
output$quickgen_basic <- renderUI({
stat_tab_panel(
menu = i18n$t("Oneclick generation > Generate descriptive statistics"),
tool = i18n$t("Generate descriptive statistics with one click"),
tool_ui = "ui_quickgen_basic",
output_panels = tagList(
tabPanel(
title = i18n$t("Table"),
download_link("dl_qgb_tab"),br(),
DT::dataTableOutput("explore")
)
)
)
})
\ No newline at end of file
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "15,2",
"scrollLine": "0"
}
\ No newline at end of file
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "18,40",
"scrollLine": "0"
}
\ No newline at end of file
{
"source_window_id": "",
"Source": "Source",
"cursorPosition": "13,70",
"scrollLine": "0"
}
\ No newline at end of file
D%3A%2FR%2Fradiant-master%2Finst%2Fapp%2Fglobal.R="B388924E"
D%3A%2FR%2Fradiant.quickgen%2FR%2Fquickgen_basic.R="60F6F2DC"
D%3A%2FR%2Fradiant.quickgen%2Finst%2Fapp%2Ftools%2Fanalysis%2Fquickgen_basic_ui.R="279BFA89"
D:/R/radiant.quickgen/R/quickgen_basic.R="741A1A01"
Package: radiant.quickgen
Version: 0.0.1
Title: Quick Generator table and chart for Radiant
Description: Provides a simple data generator for the Radiant interface.
#' 一键生成模块服务器逻辑
#' @export
quickgen_server <- function(input, output, session, r_data, r_info, r_state) {
# 为模块创建命名空间
ns <- session$ns
# 空函数,确保模块能正确加载
# 后续开发时可在此添加实际逻辑
}
\ No newline at end of file
explore <- function(dataset, vars = "", byvar = "", fun = c("mean", "sd"),
top = "fun", tabfilt = "", tabsort = "", tabslice = "",
nr = Inf, data_filter = "", arr = "", rows = NULL,
envir = parent.frame()) {
tvars <- vars
if (!is.empty(byvar)) tvars <- unique(c(tvars, byvar))
df_name <- if (is_string(dataset)) dataset else deparse(substitute(dataset))
dataset <- get_data(dataset, tvars, filt = data_filter, arr = arr, rows = rows, na.rm = FALSE, envir = envir)
rm(tvars)
## in case : was used
vars <- base::setdiff(colnames(dataset), byvar)
## converting data as needed for summarization
dc <- get_class(dataset)
fixer <- function(x, fun = as_integer) {
if (is.character(x) || is.Date(x)) {
x <- rep(NA, length(x))
} else if (is.factor(x)) {
x_num <- sshhr(as.integer(as.character(x)))
if (length(na.omit(x_num)) == 0) {
x <- fun(x)
} else {
x <- x_num
}
}
x
}
fixer_first <- function(x) {
x <- fixer(x, function(x) as_integer(x == levels(x)[1]))
}
mean <- function(x, na.rm = TRUE) sshhr(base::mean(fixer_first(x), na.rm = na.rm))
sum <- function(x, na.rm = TRUE) sshhr(base::sum(fixer_first(x), na.rm = na.rm))
var <- function(x, na.rm = TRUE) sshhr(stats::var(fixer_first(x), na.rm = na.rm))
sd <- function(x, na.rm = TRUE) sshhr(stats::sd(fixer_first(x), na.rm = na.rm))
se <- function(x, na.rm = TRUE) sshhr(radiant.data::se(fixer_first(x), na.rm = na.rm))
me <- function(x, na.rm = TRUE) sshhr(radiant.data::me(fixer_first(x), na.rm = na.rm))
cv <- function(x, na.rm = TRUE) sshhr(radiant.data::cv(fixer_first(x), na.rm = na.rm))
prop <- function(x, na.rm = TRUE) sshhr(radiant.data::prop(fixer_first(x), na.rm = na.rm))
varprop <- function(x, na.rm = TRUE) sshhr(radiant.data::varprop(fixer_first(x), na.rm = na.rm))
sdprop <- function(x, na.rm = TRUE) sshhr(radiant.data::sdprop(fixer_first(x), na.rm = na.rm))
seprop <- function(x, na.rm = TRUE) sshhr(radiant.data::seprop(fixer_first(x), na.rm = na.rm))
meprop <- function(x, na.rm = TRUE) sshhr(radiant.data::meprop(fixer_first(x), na.rm = na.rm))
varpop <- function(x, na.rm = TRUE) sshhr(radiant.data::varpop(fixer_first(x), na.rm = na.rm))
sdpop <- function(x, na.rm = TRUE) sshhr(radiant.data::sdpop(fixer_first(x), na.rm = na.rm))
median <- function(x, na.rm = TRUE) sshhr(stats::median(fixer(x), na.rm = na.rm))
min <- function(x, na.rm = TRUE) sshhr(base::min(fixer(x), na.rm = na.rm))
max <- function(x, na.rm = TRUE) sshhr(base::max(fixer(x), na.rm = na.rm))
p01 <- function(x, na.rm = TRUE) sshhr(radiant.data::p01(fixer(x), na.rm = na.rm))
p025 <- function(x, na.rm = TRUE) sshhr(radiant.data::p025(fixer(x), na.rm = na.rm))
p05 <- function(x, na.rm = TRUE) sshhr(radiant.data::p05(fixer(x), na.rm = na.rm))
p10 <- function(x, na.rm = TRUE) sshhr(radiant.data::p10(fixer(x), na.rm = na.rm))
p25 <- function(x, na.rm = TRUE) sshhr(radiant.data::p25(fixer(x), na.rm = na.rm))
p75 <- function(x, na.rm = TRUE) sshhr(radiant.data::p75(fixer(x), na.rm = na.rm))
p90 <- function(x, na.rm = TRUE) sshhr(radiant.data::p90(fixer(x), na.rm = na.rm))
p95 <- function(x, na.rm = TRUE) sshhr(radiant.data::p95(fixer(x), na.rm = na.rm))
p975 <- function(x, na.rm = TRUE) sshhr(radiant.data::p975(fixer(x), na.rm = na.rm))
p99 <- function(x, na.rm = TRUE) sshhr(radiant.data::p99(fixer(x), na.rm = na.rm))
skew <- function(x, na.rm = TRUE) sshhr(radiant.data::skew(fixer(x), na.rm = na.rm))
kurtosi <- function(x, na.rm = TRUE) sshhr(radiant.data::kurtosi(fixer(x), na.rm = na.rm))
isLogNum <- "logical" == dc & names(dc) %in% base::setdiff(vars, byvar)
if (sum(isLogNum) > 0) {
dataset[, isLogNum] <- select(dataset, which(isLogNum)) %>%
mutate_all(as.integer)
dc[isLogNum] <- "integer"
}
if (is.empty(byvar)) {
byvar <- c()
tab <- summarise_all(dataset, fun, na.rm = TRUE)
} else {
## convert categorical variables to factors if needed
## needed to deal with empty/missing values
dataset[, byvar] <- select_at(dataset, .vars = byvar) %>%
mutate_all(~ empty_level(.))
tab <- dataset %>%
group_by_at(.vars = byvar) %>%
summarise_all(fun, na.rm = TRUE)
}
## adjust column names
if (length(vars) == 1 || length(fun) == 1) {
rng <- (length(byvar) + 1):ncol(tab)
colnames(tab)[rng] <- paste0(vars, "_", fun)
rm(rng)
}
## setup regular expression to split variable/function column appropriately
rex <- paste0("(.*?)_", glue('({glue_collapse(fun, "$|")}$)'))
## useful answer and comments: http://stackoverflow.com/a/27880388/1974918
tab <- gather(tab, "variable", "value", !!-(seq_along(byvar))) %>%
extract(variable, into = c("variable", "fun"), regex = rex) %>%
mutate(fun = factor(fun, levels = !!fun), variable = factor(variable, levels = vars)) %>%
# mutate(variable = paste0(variable, " {", dc[variable], "}")) %>%
spread("fun", "value")
## flip the table if needed
if (top != "fun") {
tab <- list(tab = tab, byvar = byvar, fun = fun) %>%
flip(top)
}
nrow_tab <- nrow(tab)
## filtering the table if desired from Report > Rmd
if (!is.empty(tabfilt)) {
tab <- filter_data(tab, tabfilt)
}
## sorting the table if desired from Report > Rmd
if (!identical(tabsort, "")) {
tabsort <- gsub(",", ";", tabsort)
tab <- tab %>% arrange(!!!rlang::parse_exprs(tabsort))
}
## ensure factors ordered as in the (sorted) table
if (!is.empty(byvar) && top != "byvar") {
for (i in byvar) tab[[i]] <- tab[[i]] %>% (function(x) factor(x, levels = unique(x)))
rm(i)
}
## frequencies converted to doubles during gather/spread above
check_int <- function(x) {
if (is.double(x) && length(na.omit(x)) > 0) {
x_int <- sshhr(as.integer(round(x, .Machine$double.rounding)))
if (isTRUE(all.equal(x, x_int, check.attributes = FALSE))) x_int else x
} else {
x
}
}
tab <- ungroup(tab) %>% mutate_all(check_int)
## slicing the table if desired
if (!is.empty(tabslice)) {
tab <- tab %>%
slice_data(tabslice) %>%
droplevels()
}
## convert to data.frame to maintain attributes
tab <- as.data.frame(tab, stringsAsFactors = FALSE)
attr(tab, "radiant_nrow") <- nrow_tab
if (!isTRUE(is.infinite(nr))) {
ind <- if (nr > nrow(tab)) 1:nrow(tab) else 1:nr
tab <- tab[ind, , drop = FALSE]
rm(ind)
}
list(
tab = tab,
df_name = df_name,
vars = vars,
byvar = byvar,
fun = fun,
top = top,
tabfilt = tabfilt,
tabsort = tabsort,
tabslice = tabslice,
nr = nr,
data_filter = data_filter,
arr = arr,
rows = rows
) %>% add_class("explore")
}
summary.explore <- function(object, dec = 3, ...) {
cat("Explore\n")
cat("Data :", object$df_name, "\n")
if (!is.empty(object$data_filter)) {
cat("Filter :", gsub("\\n", "", object$data_filter), "\n")
}
if (!is.empty(object$arr)) {
cat("Arrange :", gsub("\\n", "", object$arr), "\n")
}
if (!is.empty(object$rows)) {
cat("Slice :", gsub("\\n", "", object$rows), "\n")
}
if (!is.empty(object$tabfilt)) {
cat("Table filter:", object$tabfilt, "\n")
}
if (!is.empty(object$tabsort[1])) {
cat("Table sorted:", paste0(object$tabsort, collapse = ", "), "\n")
}
if (!is.empty(object$tabslice)) {
cat("Table slice :", object$tabslice, "\n")
}
nr <- attr(object$tab, "radiant_nrow")
if (!isTRUE(is.infinite(nr)) && !isTRUE(is.infinite(object$nr)) && object$nr < nr) {
cat(paste0("Rows shown : ", object$nr, " (out of ", nr, ")\n"))
}
if (!is.empty(object$byvar[1])) {
cat("Grouped by :", object$byvar, "\n")
}
cat("Functions :", paste0(object$fun, collapse = ", "), "\n")
cat("Top :", c("fun" = "Function", "var" = "Variables", "byvar" = "Group by")[object$top], "\n")
cat("\n")
format_df(object$tab, dec = dec, mark = ",") %>%
print(row.names = FALSE)
invisible()
}
store.explore <- function(dataset, object, name, ...) {
if (missing(name)) {
object$tab
} else {
stop(
paste0(
"This function is deprecated. Use the code below instead:\n\n",
name, " <- ", deparse(substitute(object)), "$tab\nregister(\"",
name, ")"
),
call. = FALSE
)
}
}
flip <- function(expl, top = "fun") {
cvars <- expl$byvar %>%
(function(x) if (is.empty(x[1])) character(0) else x)
if (top[1] == "var") {
expl$tab %<>% gather(".function", "value", !!-(1:(length(cvars) + 1))) %>%
spread("variable", "value")
expl$tab[[".function"]] %<>% factor(., levels = expl$fun)
} else if (top[1] == "byvar" && length(cvars) > 0) {
expl$tab %<>% gather(".function", "value", !!-(1:(length(cvars) + 1))) %>%
spread(!!cvars[1], "value")
expl$tab[[".function"]] %<>% factor(., levels = expl$fun)
## ensure we don't have invalid column names
colnames(expl$tab) <- fix_names(colnames(expl$tab))
}
expl$tab
}
dtab.explore <- function(object, dec = 3, searchCols = NULL,
order = NULL, pageLength = NULL,
caption = NULL, ...) {
style <- if (exists("bslib_current_version") && "4" %in% bslib_current_version()) "bootstrap4" else "bootstrap"
tab <- object$tab
cn_all <- colnames(tab)
cn_num <- cn_all[sapply(tab, is.numeric)]
cn_cat <- cn_all[-which(cn_all %in% cn_num)]
isInt <- sapply(tab, is.integer)
isDbl <- sapply(tab, is_double)
dec <- ifelse(is.empty(dec) || dec < 0, 3, round(dec, 0))
top <- c("fun" = "Function", "var" = "Variables", "byvar" = paste0("Group by: ", object$byvar[1]))[object$top]
sketch <- shiny::withTags(
table(
thead(
tr(
th(" ", colspan = length(cn_cat)),
lapply(top, th, colspan = length(cn_num), class = "text-center")
),
tr(lapply(cn_all, th))
)
)
)
if (!is.empty(caption)) {
## from https://github.com/rstudio/DT/issues/630#issuecomment-461191378
caption <- shiny::tags$caption(style = "caption-side: bottom; text-align: left; font-size:100%;", caption)
}
## for display options see https://datatables.net/reference/option/dom
dom <- if (nrow(tab) < 11) "t" else "ltip"
fbox <- if (nrow(tab) > 5e6) "none" else list(position = "top")
dt_tab <- DT::datatable(
tab,
container = sketch,
caption = caption,
selection = "none",
rownames = FALSE,
filter = fbox,
## must use fillContainer = FALSE to address
## see https://github.com/rstudio/DT/issues/367
## https://github.com/rstudio/DT/issues/379
fillContainer = FALSE,
style = style,
options = list(
dom = dom,
stateSave = TRUE, ## store state
searchCols = searchCols,
order = order,
columnDefs = list(list(orderSequence = c("desc", "asc"), targets = "_all")),
autoWidth = TRUE,
processing = FALSE,
pageLength = {
if (is.null(pageLength)) 10 else pageLength
},
lengthMenu = list(c(5, 10, 25, 50, -1), c("5", "10", "25", "50", "All"))
),
## https://github.com/rstudio/DT/issues/146#issuecomment-534319155
callback = DT::JS('$(window).on("unload", function() { table.state.clear(); })')
) %>%
DT::formatStyle(., cn_cat, color = "white", backgroundColor = "grey")
## rounding as needed
if (sum(isDbl) > 0) {
dt_tab <- DT::formatRound(dt_tab, names(isDbl)[isDbl], dec)
}
if (sum(isInt) > 0) {
dt_tab <- DT::formatRound(dt_tab, names(isInt)[isInt], 0)
}
## see https://github.com/yihui/knitr/issues/1198
dt_tab$dependencies <- c(
list(rmarkdown::html_dependency_bootstrap("bootstrap")),
dt_tab$dependencies
)
dt_tab
}
###########################################
## turn functions below into functional ...
###########################################
n_obs <- function(x, ...) length(x)
n_missing <- function(x, ...) sum(is.na(x))
p01 <- function(x, na.rm = TRUE) quantile(x, .01, na.rm = na.rm)
p025 <- function(x, na.rm = TRUE) quantile(x, .025, na.rm = na.rm)
p05 <- function(x, na.rm = TRUE) quantile(x, .05, na.rm = na.rm)
p10 <- function(x, na.rm = TRUE) quantile(x, .1, na.rm = na.rm)
p25 <- function(x, na.rm = TRUE) quantile(x, .25, na.rm = na.rm)
p75 <- function(x, na.rm = TRUE) quantile(x, .75, na.rm = na.rm)
p90 <- function(x, na.rm = TRUE) quantile(x, .90, na.rm = na.rm)
p95 <- function(x, na.rm = TRUE) quantile(x, .95, na.rm = na.rm)
p975 <- function(x, na.rm = TRUE) quantile(x, .975, na.rm = na.rm)
p99 <- function(x, na.rm = TRUE) quantile(x, .99, na.rm = na.rm)
cv <- function(x, na.rm = TRUE) {
m <- mean(x, na.rm = na.rm)
if (m == 0) {
message("Mean should be greater than 0")
NA
} else {
sd(x, na.rm = na.rm) / m
}
}
se <- function(x, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
sd(x) / sqrt(length(x))
}
me <- function(x, conf_lev = 0.95, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
se(x) * qt(conf_lev / 2 + .5, length(x) - 1, lower.tail = TRUE)
}
prop <- function(x, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
if (is.numeric(x)) {
mean(x == max(x, 1)) ## gives proportion of max value in x
} else if (is.factor(x)) {
mean(x == levels(x)[1]) ## gives proportion of first level in x
} else if (is.logical(x)) {
mean(x)
} else {
NA
}
}
varprop <- function(x, na.rm = TRUE) {
p <- prop(x, na.rm = na.rm)
p * (1 - p)
}
sdprop <- function(x, na.rm = TRUE) sqrt(varprop(x, na.rm = na.rm))
seprop <- function(x, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
sqrt(varprop(x, na.rm = FALSE) / length(x))
}
meprop <- function(x, conf_lev = 0.95, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
seprop(x) * qnorm(conf_lev / 2 + .5, lower.tail = TRUE)
}
varpop <- function(x, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
n <- length(x)
var(x) * ((n - 1) / n)
}
sdpop <- function(x, na.rm = TRUE) sqrt(varpop(x, na.rm = na.rm))
ln <- function(x, na.rm = TRUE) {
if (na.rm) log(na.omit(x)) else log(x)
}
does_vary <- function(x, na.rm = TRUE) {
## based on http://stackoverflow.com/questions/4752275/test-for-equality-among-all-elements-of-a-single-vector
if (length(x) == 1L) {
FALSE
} else {
if (is.factor(x) || is.character(x)) {
length(unique(x)) > 1
} else {
abs(max(x, na.rm = na.rm) - min(x, na.rm = na.rm)) > .Machine$double.eps^0.5
}
}
}
empty_level <- function(x) {
if (!is.factor(x)) x <- as.factor(x)
levs <- levels(x)
if ("" %in% levs) {
levs[levs == ""] <- "NA"
x <- factor(x, levels = levs)
x[is.na(x)] <- "NA"
} else if (any(is.na(x))) {
x <- factor(x, levels = unique(c(levs, "NA")))
x[is.na(x)] <- "NA"
}
x
}
modal <- function(x, na.rm = TRUE) {
if (na.rm) x <- na.omit(x)
unv <- unique(x)
unv[which.max(tabulate(match(x, unv)))]
}
#—————————————————————————————————————————————————绘图部分———————————————————————————————————————————
visualize <- function(dataset, xvar, yvar = "", comby = FALSE, combx = FALSE,
type = ifelse(is.empty(yvar), "dist", "scatter"), nrobs = -1,
facet_row = ".", facet_col = ".", color = "none", fill = "none",
size = "none", fillcol = "blue", linecol = "black", pointcol = "black",
bins = 10, smooth = 1, fun = "mean", check = "", axes = "",
alpha = 0.5, theme = "theme_gray", base_size = 11, base_family = "",
labs = list(), xlim = NULL, ylim = NULL, data_filter = "",
arr = "", rows = NULL, shiny = FALSE, custom = FALSE,
envir = parent.frame()) {
if (missing(xvar) && type %in% c("box", "line")) {
xvar <- yvar
if (type == "box") {
type <- "box-single"
if (comby) {
comby <- FALSE
combx <- TRUE
}
} else {
type <- "line-single"
}
}
## inspired by Joe Cheng's ggplot2 browser app http://www.youtube.com/watch?feature=player_embedded&v=o2B5yJeEl1A#!
vars <- xvar
if (!type %in% c("scatter", "line", "line-single", "box")) color <- "none"
if (!type %in% c("bar", "dist", "density", "surface")) fill <- "none"
if (type != "scatter") {
check %<>% sub("line", "", .) %>% sub("loess", "", .)
if (length(fun) > 1) {
fun <- fun[1]
message("No more than one function (", fun, ") will be used for plots of type ", type)
}
size <- "none"
}
if (type == "scatter" && length(fun) > 3) {
fun <- fun[1:3]
message("No more than three functions (", paste(fun, collapse = ", "), ") can be used with scatter plots")
}
if (!type %in% c("scatter", "box", "box-single")) check %<>% sub("jitter", "", .)
## variable to use if bar chart is specified
byvar <- NULL
if (length(yvar) == 0 || identical(yvar, "")) {
if (!type %in% c("dist", "density")) {
return("No Y-variable provided for a plot that requires one")
}
} else if (type == "surface" && is.empty(fill, "none")) {
return("No Fill variable provided for a plot that requires one")
} else {
if (type %in% c("dist", "density")) {
yvar <- ""
} else {
vars %<>% c(., yvar)
}
}
if (color != "none") {
vars %<>% c(., color)
if (type == "line") byvar <- color
}
if (facet_row != ".") {
vars %<>% c(., facet_row)
byvar <- if (is.null(byvar)) facet_row else unique(c(byvar, facet_row))
}
if (facet_col != ".") {
vars %<>% c(., facet_col)
byvar <- if (is.null(byvar)) facet_col else unique(c(byvar, facet_col))
}
if (facet_col != "." && facet_row == facet_col) {
return("The same variable cannot be used for both Facet row and Facet column")
}
if (fill != "none") {
vars %<>% c(., fill)
if (type == "bar") {
byvar <- if (is.null(byvar)) fill else unique(c(byvar, fill))
}
}
if (size != "none") vars %<>% c(., size)
## so you can also pass-in a data.frame
df_name <- if (is_string(dataset)) dataset else deparse(substitute(dataset))
dataset <- get_data(dataset, vars, filt = data_filter, arr = arr, rows = rows, envir = envir)
if (type == "scatter" && !is.empty(nrobs)) {
nrobs <- as.integer(nrobs)
if (nrobs > 0 && nrobs < nrow(dataset)) {
dataset <- sample_n(dataset, nrobs, replace = FALSE)
}
}
## get class
dc <- dc_org <- get_class(dataset)
## if : is used to specify a range of variables
if (length(vars) < ncol(dataset)) {
fl <- strsplit(xvar, ":") %>% unlist()
cn <- colnames(dataset)
xvar <- cn[which(fl[1] == cn):which(fl[2] == cn)]
}
## converting character variables if needed
isChar <- dc == "character"
if (sum(isChar) > 0) {
if (type == "density") {
dataset[, isChar] <- select(dataset, which(isChar)) %>% mutate_all(as_numeric)
if ("character" %in% get_class(select(dataset, which(isChar)))) {
return("Character variable(s) were not converted to numeric for plotting.\nTo use these variables in a plot convert them to numeric\nvariables (or factors) in the Data > Transform tab")
}
} else {
dataset[, isChar] <- select(dataset, which(isChar)) %>% mutate_all(as_factor)
nrlev <- sapply(dataset, function(x) if (is.factor(x)) length(levels(x)) else 0)
if (max(nrlev) > 500) {
return("Character variable(s) were not converted to factors for plotting.\nTo use these variable in a plot convert them to factors\n(or numeric variables) in the Data > Transform tab")
}
}
## in case something was changed, if not, this won't run
dc <- get_class(dataset)
}
if (type %in% c("bar", "line")) {
if (any(xvar %in% yvar)) {
return("Cannot create a bar or line chart if an X-variable is also included as a Y-variable")
}
} else if (type == "box") {
if (any(xvar %in% yvar)) {
return("Cannot create a box-plot if an X-variable is also included as a Y-variable")
}
}
## Determine if you want to use the first level of factor or not
if (type %in% c("bar", "line")) {
isFctY <- "factor" == dc & names(dc) %in% yvar
if (sum(isFctY)) {
levs_org <- sapply(dataset[, isFctY, drop = FALSE], function(x) levels(x)[1])
levs <- c()
fixer_first <- function(x) {
x_num <- sshhr(as.integer(as.character(x)))
if (length(na.omit(x_num)) == 0) {
lx <- levels(x)
x <- as_integer(x == lx[1])
levs <<- c(levs, lx[1])
} else {
x <- x_num
levs <<- c(levs, NA)
}
x
}
fixer <- function(x) {
x_num <- sshhr(as.integer(as.character(x)))
if (length(na.omit(x_num)) == 0) {
lx <- levels(x)
x <- as_integer(x)
levs <<- c(levs, lx[1])
} else {
x <- x_num
levs <<- c(levs, NA)
}
x
}
if (fun %in% c("mean", "sum", "sd", "var", "sd", "se", "me", "cv", "prop", "varprop", "sdprop", "seprop", "meprop", "varpop", "sepop")) {
mfun <- fixer_first
} else if (fun %in% c("median", "min", "max", "p01", "p025", "p05", "p10", "p25", "p50", "p75", "p90", "p95", "p975", "p99", "skew", "kurtosi")) {
mfun <- fixer
} else {
mfun <- function(x) {
levs <<- c(levs, NA)
x
}
}
dataset[, isFctY] <- select(dataset, which(isFctY)) %>%
mutate_all(mfun)
names(levs) <- names(levs_org)
dc[isFctY] <- "integer"
}
}
if (xor("log_x" %in% axes, "log_y" %in% axes)) {
if (any(xvar %in% yvar)) {
return("When applying 'Log X' an X-variable cannot also be selected as a Y-variable")
}
if (any(yvar %in% xvar)) {
return("When applying 'Log Y' a Y-variable cannot also be selected as an X-variable")
}
}
log_trans <- function(x) ifelse(x > 0, log(x), NA)
if ("log_x" %in% axes) {
if (any(!dc[xvar] %in% c("integer", "numeric"))) {
return("'Log X' is only meaningful for X-variables of type integer or numeric")
}
to_log <- (dc[xvar] %in% c("integer", "numeric")) %>% xvar[.]
dataset <- mutate_at(dataset, .vars = to_log, .funs = log_trans)
}
if ("log_y" %in% axes) {
if (any(!dc[yvar] %in% c("integer", "numeric"))) {
return("'Log Y' is only meaningful for Y-variables of type integer or numeric")
}
to_log <- (dc[yvar] %in% c("integer", "numeric")) %>% yvar[.]
dataset <- mutate_at(dataset, .vars = to_log, .funs = log_trans)
}
## combining Y-variables if needed
if (comby && length(yvar) > 1) {
if (any(xvar %in% yvar) && !type %in% c("box-single", "line-single")) {
return("X-variables cannot be part of Y-variables when combining Y-variables")
}
if (!is.empty(color, "none")) {
return("Cannot use Color when combining Y-variables")
}
if (!is.empty(fill, "none")) {
return("Cannot use Fill when combining Y-variables")
}
if (!is.empty(size, "none")) {
return("Cannot use Size when combining Y-variables")
}
if (facet_row %in% yvar || facet_col %in% yvar) {
return("Facet row or column variables cannot be part of\nY-variables when combining Y-variables")
}
dataset <- gather(dataset, "yvar", "values", !!yvar, factor_key = TRUE)
yvar <- "values"
byvar <- if (is.null(byvar)) "yvar" else c("yvar", byvar)
color <- fill <- "yvar"
dc <- get_class(dataset)
}
## combining X-variables if needed
if (combx && length(xvar) > 1) {
if (!is.empty(fill, "none")) {
return("Cannot use Fill when combining X-variables")
}
if (facet_row %in% xvar || facet_col %in% xvar) {
return("Facet row or column variables cannot be part of\nX-variables when combining Y-variables")
}
if (any(!get_class(select_at(dataset, .vars = xvar)) %in% c("numeric", "integer"))) {
return("Cannot combine plots for non-numeric variables")
}
dataset <- gather(dataset, "xvar", "values", !!xvar, factor_key = TRUE)
xvar <- "values"
byvar <- if (is.null(byvar)) "xvar" else c("xvar", byvar)
color <- fill <- "xvar"
dc <- get_class(dataset)
}
plot_list <- list()
if (type == "dist") {
for (i in xvar) {
## can't create a distribution plot for a logical
if (dc[i] == "logical") {
dataset[[i]] <- as_factor(dataset[[i]])
dc[i] <- "factor"
}
hist_par <- list(alpha = alpha, position = "stack")
if (combx) hist_par[["position"]] <- "identity"
if (fill == "none") hist_par[["fill"]] <- fillcol
plot_list[[i]] <- ggplot(dataset, aes(x = .data[[i]]))
if ("density" %in% axes && !"factor" %in% dc[i]) {
hist_par <- c(list(aes(y = after_stat(density))), hist_par)
plot_list[[i]] <- plot_list[[i]] + geom_density(adjust = smooth, color = linecol, linewidth = .5)
}
if ("factor" %in% dc[i]) {
plot_fun <- get("geom_bar")
if ("log_x" %in% axes) axes <- sub("log_x", "", axes)
} else {
plot_fun <- get("geom_histogram")
hist_par[["binwidth"]] <- select_at(dataset, .vars = i) %>%
range() %>%
{
diff(.) / (bins - 1)
}
}
plot_list[[i]] <- plot_list[[i]] + do.call(plot_fun, hist_par)
if ("log_x" %in% axes) plot_list[[i]] <- plot_list[[i]] + xlab(paste("log", i))
}
} else if (type == "density") {
for (i in xvar) {
plot_list[[i]] <- ggplot(dataset, aes(x = .data[[i]])) +
if (fill == "none") {
geom_density(adjust = smooth, color = linecol, fill = fillcol, alpha = alpha, linewidth = 1)
} else {
geom_density(adjust = smooth, alpha = alpha, linewidth = 1)
}
if ("log_x" %in% axes) plot_list[[i]] <- plot_list[[i]] + xlab(paste("log", i))
}
} else if (type == "scatter") {
itt <- 1
if ("jitter" %in% check) {
if (color == "none") {
gs <- geom_jitter(alpha = alpha, color = pointcol, position = position_jitter(width = 0.4, height = 0.0))
} else {
gs <- geom_jitter(alpha = alpha, position = position_jitter(width = 0.4, height = 0.0))
}
check <- sub("jitter", "", check)
} else {
if (color == "none") {
gs <- geom_point(alpha = alpha, color = pointcol)
} else {
gs <- geom_point(alpha = alpha)
}
}
for (i in xvar) {
if ("log_x" %in% axes && dc[i] == "factor") axes <- sub("log_x", "", axes)
for (j in yvar) {
plot_list[[itt]] <- ggplot(dataset, aes(x = .data[[i]], y = .data[[j]])) + gs
if ("log_x" %in% axes) plot_list[[itt]] <- plot_list[[itt]] + xlab(paste("log", i))
if ("log_y" %in% axes) plot_list[[itt]] <- plot_list[[itt]] + ylab(paste("log", j))
if (dc[i] == "factor") {
## make range comparable to bar plot
ymax <- max(0, max(dataset[[j]]))
ymin <- min(0, min(dataset[[j]]))
plot_list[[itt]] <- plot_list[[itt]] + ylim(ymin, ymax)
fun1 <- function(y) {
y <- get(fun[1])(y)
data.frame(ymin = y, ymax = y, y = y, stringsAsFactors = FALSE)
}
if (length(fun) == 1) {
## need some contrast in this case
if (pointcol[1] == "black" && linecol[1] == "black") {
linecol[1] <- "blue"
}
plot_list[[itt]] <- plot_list[[itt]] +
stat_summary(
fun.data = fun1, na.rm = TRUE, aes(fill = fun[1]),
geom = "crossbar", show.legend = FALSE,
color = linecol[1]
)
} else {
plot_list[[itt]] <- plot_list[[itt]] +
stat_summary(
fun.data = fun1, na.rm = TRUE, aes(fill = fun[1]),
geom = "crossbar", show.legend = TRUE,
color = linecol[1]
)
if (length(fun) > 1) {
fun2 <- function(y) {
y <- get(fun[2])(y)
data.frame(ymin = y, ymax = y, y = y, stringsAsFactors = FALSE)
}
if (length(linecol) == 1) linecol <- c(linecol, "blue")
plot_list[[itt]] <- plot_list[[itt]] +
stat_summary(
fun.data = fun2, na.rm = TRUE, aes(fill = fun[2]),
geom = "crossbar", show.legend = FALSE,
color = linecol[2]
)
}
if (length(fun) == 3) {
fun3 <- function(y) {
y <- get(fun[3])(y)
data.frame(ymin = y, ymax = y, y = y, stringsAsFactors = FALSE)
}
if (length(linecol) == 2) linecol <- c(linecol, "red")
plot_list[[itt]] <- plot_list[[itt]] +
stat_summary(
fun.data = fun3, na.rm = TRUE, aes(fill = fun[3]),
geom = "crossbar", show.legend = FALSE,
color = linecol[3]
)
}
## adding a legend if needed
plot_list[[itt]] <- plot_list[[itt]] +
scale_fill_manual(name = "", values = linecol, labels = fun) +
## next line based on https://stackoverflow.com/a/25294787/1974918
guides(fill = guide_legend(override.aes = list(color = NULL)))
}
nr <- nrow(dataset)
if (nr > 1000 || nr != length(unique(dataset[[i]]))) {
plot_list[[itt]]$labels$y %<>% paste0(., " (", paste(fun, collapse = ", "), ")")
}
}
itt <- itt + 1
}
}
} else if (type == "surface") {
itt <- 1
for (i in xvar) {
if ("log_x" %in% axes && dc[i] == "factor") axes <- sub("log_x", "", axes)
interpolate <- ifelse("interpolate" %in% check, TRUE, FALSE)
for (j in yvar) {
plot_list[[itt]] <- ggplot(dataset, aes(x = .data[[i]], y = .data[[j]], fill = .data[[fill]])) +
geom_raster(interpolate = interpolate)
if ("log_x" %in% axes) plot_list[[itt]] <- plot_list[[itt]] + xlab(paste("log", i))
if ("log_y" %in% axes) plot_list[[itt]] <- plot_list[[itt]] + ylab(paste("log", j))
itt <- itt + 1
}
}
} else if (type == "line") {
itt <- 1
for (i in xvar) {
for (j in yvar) {
flab <- ""
if (color == "none") {
if (dc[i] %in% c("factor", "date") || dc_org[j] == "factor") {
tbv <- if (is.null(byvar)) i else c(i, byvar)
tmp <- dataset %>%
group_by_at(.vars = tbv) %>%
select_at(.vars = c(tbv, j)) %>%
na.omit() %>%
summarise_all(fun)
colnames(tmp)[ncol(tmp)] <- j
plot_list[[itt]] <- ggplot(tmp, aes(x = .data[[i]], y = .data[[j]])) +
geom_line(aes(group = 1), color = linecol)
if (nrow(tmp) < 101) plot_list[[itt]] <- plot_list[[itt]] + geom_point(color = pointcol)
} else {
plot_list[[itt]] <- ggplot(dataset, aes(x = .data[[i]], y = .data[[j]])) +
geom_line(color = linecol)
}
} else {
if (dc[i] %in% c("factor", "date") || (!is.empty(dc_org[j]) && dc_org[j] == "factor")) {
tbv <- if (is.null(byvar)) i else unique(c(i, byvar))
tmp <- dataset %>%
group_by_at(.vars = tbv) %>%
select_at(.vars = c(tbv, color, j)) %>%
na.omit() %>%
summarise_all(fun)
colnames(tmp)[ncol(tmp)] <- j
plot_list[[itt]] <- ggplot(tmp, aes(x = .data[[i]], y = .data[[j]], color = .data[[color]], group = .data[[color]])) +
geom_line()
if (nrow(tmp) < 101) plot_list[[itt]] <- plot_list[[itt]] + geom_point()
} else {
plot_list[[itt]] <- ggplot(dataset, aes(x = .data[[i]], y = .data[[j]], color = .data[[color]], group = .data[[color]])) +
geom_line()
}
}
if ("log_x" %in% axes) plot_list[[itt]] <- plot_list[[itt]] + xlab(paste("log", i))
if ("log_y" %in% axes) plot_list[[itt]] <- plot_list[[itt]] + ylab(paste("log", j))
if ((dc[i] %in% c("factor", "date") || (!is.empty(dc_org[j]) && dc_org[j] == "factor")) && nrow(tmp) < nrow(dataset)) {
if (exists("levs")) {
if (j %in% names(levs) && !is.na(levs[j])) {
plot_list[[itt]]$labels$y %<>% paste0(., " (", fun, " {", levs[j], "})")
} else {
plot_list[[itt]]$labels$y %<>% paste0(., " (", fun, ")")
}
} else {
plot_list[[itt]]$labels$y %<>% paste0(., " (", fun, ")")
}
}
itt <- itt + 1
}
}
} else if (type == "line-single") {
itt <- 1
for (i in yvar) {
if (color == "none") {
plot_list[[itt]] <- ggplot(dataset, aes(x = seq_along(.data[[i]]), y = .data[[i]])) +
geom_line(color = linecol) +
labs(x = "")
} else {
plot_list[[itt]] <- ggplot(dataset, aes(x = seq_along(.data[[i]]), y = .data[[i]], color = .data[[color]], group = .data[[color]])) +
geom_line() +
labs(x = "")
}
itt <- itt + 1
}
} else if (type == "bar") {
itt <- 1
for (i in xvar) {
if (!"factor" %in% dc[i]) dataset[[i]] %<>% as_factor()
if ("log_x" %in% axes) axes <- sub("log_x", "", axes)
for (j in yvar) {
tbv <- if (is.null(byvar)) i else c(i, byvar)
tmp <- dataset %>%
group_by_at(.vars = tbv) %>%
select_at(.vars = c(tbv, j)) %>%
na.omit() %>%
summarise_all(fun)
colnames(tmp)[ncol(tmp)] <- j
if ("sort" %in% axes && facet_row == "." && facet_col == ".") {
if ("flip" %in% axes) {
tmp <- arrange_at(ungroup(tmp), .vars = j)
} else {
tmp <- arrange_at(ungroup(tmp), .vars = j, .funs = desc)
}
tmp[[i]] %<>% factor(., levels = unique(.))
}
plot_list[[itt]] <- ggplot(tmp, aes(x = .data[[i]], y = .data[[j]])) + {
if (fill == "none") {
geom_bar(stat = "identity", position = "dodge", alpha = alpha, fill = fillcol)
} else {
geom_bar(stat = "identity", position = "dodge", alpha = alpha)
}
}
if (!custom && (fill == "none" || fill == i)) {
plot_list[[itt]] <- plot_list[[itt]] + theme(legend.position = "none")
}
if ("log_y" %in% axes) plot_list[[itt]] <- plot_list[[itt]] + ylab(paste("log", j))
if (dc[i] %in% c("factor", "integer", "date") && nrow(tmp) < nrow(dataset)) {
if (exists("levs")) {
if (j %in% names(levs) && !is.na(levs[j])) {
plot_list[[itt]]$labels$y %<>% paste0(., " (", fun, " {", levs[j], "})")
} else {
plot_list[[itt]]$labels$y %<>% paste0(., " (", fun, ")")
}
} else {
plot_list[[itt]]$labels$y %<>% paste0(., " (", fun, ")")
}
}
itt <- itt + 1
}
}
} else if (type == "box") {
itt <- 1
for (i in xvar) {
if (!"factor" %in% dc[i]) dataset[[i]] %<>% as_factor
for (j in yvar) {
if (color == "none") {
plot_list[[itt]] <- ggplot(dataset, aes(x = .data[[i]], y = .data[[j]])) +
geom_boxplot(alpha = alpha, fill = fillcol, outlier.color = pointcol, color = linecol)
} else {
plot_list[[itt]] <- ggplot(dataset, aes(x = .data[[i]], y = .data[[j]], fill = .data[[color]])) +
geom_boxplot(alpha = alpha)
}
if (!custom && (color == "none" || color == i)) {
plot_list[[itt]] <- plot_list[[itt]] + theme(legend.position = "none")
}
if ("log_y" %in% axes) plot_list[[itt]] <- plot_list[[itt]] + ylab(paste("log", j))
itt <- itt + 1
}
}
} else if (type == "box-single") {
itt <- 1
for (i in xvar) {
if (color == "none") {
plot_list[[itt]] <- dataset %>% ggplot(aes(x = "", y = .data[[i]])) +
geom_boxplot(alpha = alpha, fill = fillcol, outlier.color = pointcol, color = linecol) +
scale_x_discrete(labels = NULL, breaks = NULL) +
labs(x = "")
} else {
plot_list[[itt]] <- dataset %>% ggplot(aes(x = "", y = .data[[i]], fill = color)) +
geom_boxplot(alpha = alpha)
}
if (!custom && (color == "none" || color == i)) {
plot_list[[itt]] <- plot_list[[itt]] + theme(legend.position = "none")
}
if ("log_y" %in% axes) plot_list[[itt]] <- plot_list[[itt]] + ylab(paste("log", i))
itt <- itt + 1
}
}
if (facet_row != "." || facet_col != ".") {
facets <- if (facet_row == ".") {
paste("~", facet_col)
} else {
paste(facet_row, "~", facet_col)
}
scl <- if ("scale_y" %in% axes) "free_y" else "fixed"
facet_fun <- if (facet_row == ".") facet_wrap else facet_grid
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] + facet_fun(as.formula(facets), scales = scl)
}
}
if (color != "none") {
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] + aes(color = .data[[color]])
}
}
if (size != "none") {
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] + aes(size = .data[[size]])
}
}
if (fill != "none") {
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] + aes(fill = .data[[fill]])
}
}
if ((length(xlim) == 2 && is.numeric(xlim)) &&
(length(ylim) == 2 && is.numeric(ylim))) {
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] + coord_cartesian(xlim = xlim, ylim = ylim)
}
} else if (length(xlim) == 2 && is.numeric(xlim)) {
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] + coord_cartesian(xlim = xlim)
}
} else if (length(ylim) == 2 && is.numeric(ylim)) {
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] + coord_cartesian(ylim = ylim)
}
}
if ("jitter" %in% check) {
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] +
geom_jitter(alpha = alpha, position = position_jitter(width = 0.4, height = 0.0))
}
}
if ("line" %in% check) {
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] +
sshhr(geom_smooth(method = "lm", alpha = 0.2, linewidth = .75, linetype = "dashed"))
}
}
if ("loess" %in% check) {
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] +
sshhr(geom_smooth(span = smooth, method = "loess", alpha = 0.2, linewidth = .75, linetype = "dotdash"))
}
}
if ("flip" %in% axes) {
## reverse legend ordering if available
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] + coord_flip() +
guides(fill = guide_legend(reverse = TRUE)) +
guides(color = guide_legend(reverse = TRUE))
}
}
if (length(labs) > 0) {
if (is.list(labs[[1]])) {
for (i in 1:length(labs)) {
plot_list[[i]] <- plot_list[[i]] + do.call(ggplot2::labs, labs[[i]])
}
} else {
plot_list[[1]] <- plot_list[[1]] + do.call(ggplot2::labs, labs)
}
}
## setting theme
for (i in 1:length(plot_list)) {
plot_list[[i]] <- plot_list[[i]] +
get(theme)(base_size = ifelse(is.na(base_size), 11, base_size), base_family = base_family)
}
if (custom) {
if (length(plot_list) == 1) plot_list[[1]] else plot_list
} else {
patchwork::wrap_plots(plot_list, ncol = min(length(plot_list), 2)) %>%
(function(x) if (isTRUE(shiny)) x else print(x))
}
}
qscatter <- function(dataset, xvar, yvar, lev = "", fun = "mean", bins = 20) {
if (is.character(dataset[[yvar]])) {
dataset <- mutate_at(dataset, .vars = yvar, .funs = as.factor)
}
if (is.factor(dataset[[yvar]])) {
if (is.empty(lev)) lev <- levels(pull(dataset, !!yvar))[1]
dataset <- mutate_at(dataset, .vars = yvar, .funs = function(y) as.integer(y == lev))
lev <- paste0(" {", lev, "}")
} else {
lev <- ""
}
mutate_at(dataset, .vars = xvar, .funs = list(bins = ~ radiant.data::xtile(., bins))) %>%
group_by(bins) %>%
summarize_at(.vars = c(xvar, yvar), .funs = fun) %>%
ggplot(aes(x = .data[[xvar]], y = .data[[yvar]])) +
geom_point() +
labs(y = paste0(yvar, " (", fun, lev, ")"))
}
## sourcing from radiant.data
options(radiant.path.data = system.file(package = "radiant.data"))
source(file.path(getOption("radiant.path.data"), "app/global.R"), encoding = getOption("radiant.encoding", default = "UTF-8"), local = TRUE)
ifelse(grepl("radiant.quickgen", getwd()) && file.exists("../../inst"), "..", system.file(package = "radiant.quickgen")) %>%
options(radiant.path.quickgen = .)
## setting path for www resources
addResourcePath("www_quickgen", file.path(getOption("radiant.path.quickgen"), "app/www/"))
## loading urls and ui
source("init.R", encoding = getOption("radiant.encoding", "UTF-8"), local = TRUE)
options(radiant.url.patterns = make_url_patterns())
if (!"package:radiant.quickgen" %in% search() &&
isTRUE(getOption("radiant.development")) &&
getOption("radiant.path.quickgen") == "..") {
options(radiant.from.package = FALSE)
} else {
options(radiant.from.package = TRUE)
}
\ No newline at end of file
help_quickgen <- c(
"一键生成描述性统计" = "quickgen_basic.md",
"大模型生成描述性统计" = "quickgen_ai.md"
)
output$help_quickgen <- reactive(append_help("help_quickgen", file.path(getOption("radiant.path.quickgen"), "app/tools/help"), Rmd = TRUE))
observeEvent(input$help_quickgen_all, {
help_switch(input$help_quickgen_all, "help_quickgen")
})
observeEvent(input$help_quickgen_none, {
help_switch(input$help_quickgen_none, "help_quickgen", help_on = FALSE)
})
help_quickgen_panel <- tagList(
wellPanel(
HTML("<label>一键生成菜单: <i id='help_quickgen_all' title='全选' href='#' class='action-button glyphicon glyphicon-ok'></i>
<i id='help_quickgen_none' title='取消全选' href='#' class='action-button glyphicon glyphicon-remove'></i></label>"),
checkboxGroupInput(
"help_quickgen", NULL, help_quickgen,
selected = state_group("help_quickgen"), inline = TRUE
)
)
)
\ No newline at end of file
## urls for menu
r_url_list <- getOption("radiant.url.list")
r_url_list[["Generate descriptive statistics with one click"]] <- "quickgen/basic/"
r_url_list[["LLM generates descriptive statistics"]] <- "quickgen/ai/"
options(radiant.url.list = r_url_list)
rm(r_url_list)
## quickgen menu
options(
radiant.quickgen_ui =
tagList(
navbarMenu(
i18n$t("Oneclick generation"),
tags$head(
tags$script(src = "www_quickgen/js/run_return.js")
),
tabPanel(i18n$t("Generate descriptive statistics with one click"), uiOutput("quickgen_basic")),
tabPanel(i18n$t("LLM generates descriptive statistics"), uiOutput("quickgen_ai"))
)
)
)
\ No newline at end of file
if (isTRUE(getOption("radiant.from.package"))) {
library(radiant.quickgen)
}
shinyServer(function(input, output, session) {
## source shared functions
source(file.path(getOption("radiant.path.data"), "app/init.R"), encoding = getOption("radiant.encoding"), local = TRUE)
source(file.path(getOption("radiant.path.data"), "app/radiant.R"), encoding = getOption("radiant.encoding"), local = TRUE)
## source data & app tools from radiant.data
for (file in list.files(
c(
file.path(getOption("radiant.path.data"), "app/tools/app"),
file.path(getOption("radiant.path.data"), "app/tools/data")
),
pattern = "\\.(r|R)$",
full.names = TRUE)) {
source(file, encoding = getOption("radiant.encoding"), local = TRUE)
}
## setting up help
source("help.R", encoding = getOption("radiant.encoding"), local = TRUE)
## help ui
output$help_quickgen_ui <- renderUI({
sidebarLayout(
sidebarPanel(
help_data_panel,
help_quickgen_panel,
uiOutput("help_text"),
width = 3
),
mainPanel(
HTML(paste0("<h2>Select help files to show and search</h2><hr>")),
htmlOutput("help_data"),
htmlOutput("help_quickgen")
)
)
})
## packages to use for example data
options(radiant.example.data = c("radiant.data", "radiant.quickgen"))
## 'sourcing' package functions in the server.R environment for development
if (!isTRUE(getOption("radiant.from.package"))) {
for (file in list.files("../../R", pattern = "\\.(r|R)$", full.names = TRUE)) {
source(file, encoding = getOption("radiant.encoding"), local = TRUE)
}
cat("\nGetting radiant.quickgen from source ...\n")
}
## source analysis tools for quickgen app
for (file in list.files(c("tools/analysis"), pattern = "\\.(r|R)$", full.names = TRUE))
source(file, encoding = getOption("radiant.encoding"), local = TRUE)
## save state on refresh or browser close
saveStateOnRefresh(session)
})
#' 大模型生成描述性统计界面
quickgen_ai_ui <- function() {
tagList(
h3("大模型生成描述性统计"),
p("正在开发中...")
)
}
quickgen_ai_ui()
\ No newline at end of file
make_desc_text <- function(df) {
if (is.null(df) || nrow(df) == 0) return(i18n$t("No data available"))
## 只保留数值列
num_cols <- sapply(df, is.numeric)
if (sum(num_cols) == 0) return("No numerical variable available")
df_num <- df[, num_cols, drop = FALSE]
buf <- c(i18n$t("### Current data overview"))
buf <- c(buf, sprintf("- **Sample size**:%d records", nrow(df)))
## 连续变量
for (v in names(df_num)) {
x <- df_num[[v]]
x <- x[!is.na(x)]
if (length(x) == 0) next
buf <- c(buf, sprintf(
"- **%s**: mean %.2f ± %.2f; median %.2f; range [%.2f, %.2f]; missing %.1f%%",
v,
mean(x), sd(x), median(x), min(x), max(x),
100 * (1 - length(x) / nrow(df))
))
}
## 分类变量
cat_cols <- sapply(df, function(z) is.factor(z) || is.character(z))
for (v in names(df)[cat_cols]) {
tbl <- table(df[[v]], useNA = "ifany")
lev_txt <- paste(sprintf("%s (%d, %.1f%%)",
names(tbl), tbl,
100 * tbl / sum(tbl)), collapse = "、")
buf <- c(buf, sprintf("- **%s**:%s", v, lev_txt))
}
paste(buf, collapse = "\n")
}
## quickgen_basic 的形参列表
default_funs <- c("n_obs", "mean", "sd", "min", "max")
qib_type <- c(
"分布图(dist)" = "dist", "密度图(density)" = "density", "散点图(scatter)" = "scatter",
"曲面图(surface)" = "surface", "折线图(line)" = "line", "条形图(bar)" = "bar", "箱线图(box)" = "box"
)
qib_check <- c(
"直线(line)" = "line", "局部加权回归(loess)" = "loess",
"抖动(jitter)" = "jitter",
"插值(interpolate)" = "interpolate"
)
qib_axes <- c(
"翻转坐标轴(flip)" = "flip", "X轴对数变换(log_x)" = "log_x", "Y轴对数变换(log_y)" = "log_y",
"Y轴缩放(scale_y)" = "scale_y", "密度(density)" = "density", "排序(sort)" = "sort"
)
qib_theme <- c(
"灰色主题(gray)" = "theme_gray", "黑白主题(bw)" = "theme_bw",
"明亮主题(light)" = "theme_light", "暗黑主题(dark)" = "theme_dark",
"极简主题(minimal)" = "theme_minimal", "经典主题(classic)" = "theme_classic"
)
os_type <- Sys.info()["sysname"]
if (os_type == "Windows") {
fnt <- names(windowsFonts())
names(fnt) <- tools::toTitleCase(fnt)
qib_base_family <- c("Theme default" = "", fnt)
} else {
qib_base_family <- c(
"Theme default" = "", "Helvetica" = "Helvetica", "Serif" = "serif",
"Sans" = "sans", "Mono" = "mono", "Courier" = "Courier", "Times" = "Times"
)
}
qib_labs <- c(i18n$t("title"), i18n$t("subtitle"), i18n$t("caption"), i18n$t("x"), i18n$t("y"))
qib_add_labs <- function() {
lab_list <- list()
for (l in qib_labs) {
inp <- input[[paste0("qib_labs_", l)]]
if (!is.empty(inp)) lab_list[[l]] <- inp
}
lab_list
}
qgb_args <- as.list(formals(explore))
qib_args <- as.list(formals(visualize))
## 收集用户输入的 reactive 列表
qgb_inputs <- reactive({
qgb_args$data_filter <- if (input$show_filter) input$data_filter else ""
qgb_args$arr <- if (input$show_filter) input$data_arrange else ""
qgb_args$rows <- if (input$show_filter) input$data_rows else ""
qgb_args$dataset <- input$dataset
for (i in r_drop(names(qgb_args))) {
qgb_args[[i]] <- input[[paste0("qgb_", i)]]
}
qgb_args
})
qgb_sum_args <- as.list(if (exists("summary.explore")) {
formals(summary.explore)
} else {
formals(radiant.data:::summary.explore)
})
qib_inputs <- reactive({
qib_args$data_filter <- if (isTRUE(input$show_filter)) input$data_filter else ""
qib_args$arr <- if (isTRUE(input$show_filter)) input$data_arrange else ""
qib_args$rows <- if (isTRUE(input$show_filter)) input$data_rows else ""
qib_args$dataset <- input$dataset
qib_args$shiny <- input$shiny
qib_args$labs <- qib_add_labs()
for (i in r_drop(names(qib_args), drop = c(i18n$t("dataset"), i18n$t("data_filter"), i18n$t("arr"), i18n$t("rows"), i18n$t("labs")))) {
qib_args[[i]] <- input[[paste0("qib_", i)]]
}
qib_args
})
## list of function inputs selected by user
qgb_sum_inputs <- reactive({
## loop needed because reactive values don't allow single bracket indexing
for (i in names(qgb_sum_args)) {
qgb_sum_args[[i]] <- input[[paste0("qgb_", i)]]
}
qgb_sum_args
})
## UI-elements
output$ui_qgb_vars <- renderUI({
vars <- varnames()
req(available(vars))
selectizeInput(
"qgb_vars",
label = i18n$t("Numeric variable(s):"),
choices = vars,
selected = state_multiple("qgb_vars", vars, isolate(input$qgb_vars)),
multiple = TRUE,
options = list(
placeholder = i18n$t("Select numeric variables"),
plugins = list("remove_button", "drag_drop")
)
)
})
output$ui_qgb_byvar <- renderUI({
withProgress(message = i18n$t("Acquiring variable information"), value = 1, {
vars <- groupable_vars()
})
req(available(vars))
if (any(vars %in% input$qgb_vars)) {
vars <- base::setdiff(vars, input$qgb_vars)
names(vars) <- varnames() %>%
(function(x) x[match(vars, x)]) %>%
names()
}
isolate({
## if nothing is selected expl_byvar is also null
if ("qgb_byvar" %in% names(input) && is.null(input$qgb_byvar)) {
r_state$qgb_byvar <<- NULL
} else {
if (available(r_state$qgb_byvar) && all(r_state$qgb_byvar %in% vars)) {
vars <- unique(c(r_state$qgb_byvar, vars))
names(vars) <- varnames() %>%
(function(x) x[match(vars, x)]) %>%
names()
}
}
})
selectizeInput(
"qgb_byvar",
label = i18n$t("Group by:"), choices = vars,
selected = state_multiple("qgb_byvar", vars, isolate(input$qgb_byvar)),
multiple = TRUE,
options = list(
placeholder = i18n$t("Select group-by variable"),
plugins = list("remove_button", "drag_drop")
)
)
})
output$ui_qgb_fun <- renderUI({
r_funs <- getOption("radiant.functions")
selected <- isolate(
if (is.empty(input$qgb_fun)) default_funs else input$qgb_fun
)
tagList(
div(
style = "margin-top: 5px; display: flex; gap: 3px; flex-wrap: wrap;",
actionButton("qgb_select_all", i18n$t("Select All"),
class = "btn-xs btn-primary", icon = icon("check-square")),
actionButton("qgb_deselect_all", i18n$t("Deselect All"),
class = "btn-xs btn-primary", icon = icon("square")),
actionButton("qgb_invert_selection", i18n$t("Invert"),
class = "btn-xs btn-primary", icon = icon("undo"))
),
checkboxGroupInput(
inputId = "qgb_fun",
label = i18n$t("Apply function(s):"),
choices = r_funs,
selected = selected
)
)
})
output$ui_qgb_top <- renderUI({
if (is.empty(input$qgb_vars)) {
return()
}
top_var <- setNames(
c("fun", "var", "byvar"),
c(i18n$t("Function"), i18n$t("Variables"), i18n$t("Group by"))
)
if (is.empty(input$qgb_byvar)) top_var <- top_var[1:2]
selectizeInput(
"qgb_top",
label = i18n$t("Column header:"),
choices = top_var,
selected = state_single("qgb_top", top_var, isolate(input$qgb_top)),
multiple = FALSE
)
})
output$ui_qgb_name <- renderUI({
req(input$dataset)
textInput("qgb_name", i18n$t("Store as:"), "", placeholder = i18n$t("Provide a table name"))
})
output$ui_qgb_run <- renderUI({
## updates when dataset changes
req(input$dataset)
actionButton("qgb_run", i18n$t("OneClick table generation"), width = "100%", icon = icon("play", verify_fa = FALSE), class = "btn-success")
})
## add a spinning refresh icon if the table needs to be (re)calculated
run_refresh(qgb_args, "qgb", init = "vars", label = i18n$t("OneClick table generation"), relabel = i18n$t("Update table"))
#######################################
# Visualize data
#######################################
output$ui_qib_type <- renderUI({
selectInput(
inputId = "qib_type", label = i18n$t("Plot-type:"), choices = qib_type,
selected = state_single("qib_type", qib_type),
multiple = FALSE
)
})
output$ui_qib_nrobs <- renderUI({
req(input$qib_type == "scatter")
nrobs <- nrow(.get_data())
choices <- c("1,000" = 1000, "5,000" = 5000, "10,000" = 10000, "All" = -1) %>%
.[. < nrobs]
selectInput(
"qib_nrobs", i18n$t("Number of data points plotted:"),
choices = choices,
selected = state_single("qib_nrobs", choices, 1000)
)
})
## Y - variable
output$ui_qib_yvar <- renderUI({
req(input$qib_type)
vars <- varying_vars()
req(available(vars))
vars <- vars["date" != .get_class()[vars]]
if (input$qib_type %in% c("line", "bar", "scatter", "surface", "box")) {
vars <- vars["character" != .get_class()[vars]]
}
if (input$qib_type %in% c("box", "scatter")) {
vars <- vars["factor" != .get_class()[vars]]
}
selectizeInput(
inputId = "qib_yvar",
label = i18n$t("Y-variable:"),
choices = vars,
selected = state_multiple("qib_yvar", vars, isolate(input$qib_yvar)),
multiple = TRUE,
options = list(
placeholder = i18n$t("Select Y variable(s)"),
plugins = list("remove_button", "drag_drop")
)
)
})
## X - variable
output$ui_qib_xvar <- renderUI({
req(input$qib_type)
vars <- varying_vars()
req(available(vars))
if (input$qib_type == "dist") vars <- vars["date" != .get_class()[vars]]
if (input$qib_type == "density") vars <- vars["factor" != .get_class()[vars]]
if (input$qib_type %in% c("box", "bar")) vars <- groupable_vars_nonum()
selectizeInput(
inputId = "qib_xvar",
label = i18n$t("X-variable:"),
choices = vars,
selected = state_multiple("qib_xvar", vars, isolate(input$qib_xvar)),
multiple = TRUE,
options = list(
placeholder = i18n$t("Select X variable(s)"),
plugins = list("remove_button", "drag_drop")
)
)
})
output$ui_qib_comby <- renderUI({
checkboxInput(
"qib_comby", i18n$t("Combine Y-variables in one plot"),
state_init("qib_comby", FALSE)
)
})
output$ui_qib_combx <- renderUI({
checkboxInput(
"qib_combx", i18n$t("Combine X-variables in one plot"),
state_init("qib_combx", FALSE)
)
})
observeEvent(length(input$qib_xvar) < 2, {
updateCheckboxInput(session, "qib_combx", value = FALSE)
})
observeEvent(length(input$qib_yvar) < 2, {
updateCheckboxInput(session, "qib_comby", value = FALSE)
})
observeEvent(input$qib_type, {
if (input$qib_type %in% c("dist", "density")) {
updateCheckboxInput(session, "qib_comby", value = FALSE)
} else {
updateCheckboxInput(session, "qib_combx", value = FALSE)
}
})
observeEvent(input$qib_check, {
if (!"loess" %in% input$qib_check && input$qib_smooth != 1) {
updateSliderInput(session, "qib_smooth", value = 1)
}
})
# output$ui_qib_facet_row <- renderUI({
# vars <- c("None" = ".", groupable_vars_nonum())
# selectizeInput(
# "qib_facet_row", i18n$t("Facet row:"), vars,
# selected = state_single("qib_facet_row", vars, init = "."),
# multiple = FALSE
# )
# })
# output$ui_qib_facet_col <- renderUI({
# vars <- c("None" = ".", groupable_vars_nonum())
# selectizeInput(
# "qib_facet_col", i18n$t("Facet column:"), vars,
# selected = state_single("qib_facet_col", vars, init = "."),
# multiple = FALSE
# )
# })
# output$ui_qib_color <- renderUI({
# req(input$qib_type)
# if (input$qib_type == "line") {
# vars <- c("None" = "none", groupable_vars())
# } else {
# vars <- c("None" = "none", varnames())
# }
#
# if (isTRUE(input$qib_comby) && length(input$qib_yvar) > 1) vars <- c("None" = "none")
# selectizeInput(
# "qib_color", i18n$t("Color:"), vars,
# multiple = FALSE,
# selected = state_single("qib_color", vars, init = "none")
# )
# })
# output$ui_qib_fill <- renderUI({
# vars <- c("None" = "none", groupable_vars())
# if (isTRUE(input$qib_combx) && length(input$qib_xvar) > 1) vars <- vars[1]
# selectizeInput(
# "qib_fill", i18n$t("Fill:"), vars,
# multiple = FALSE,
# selected = state_single("qib_fill", vars, init = "none")
# )
# })
# output$ui_qib_size <- renderUI({
# req(input$qib_type)
# isNum <- .get_class() %in% c("integer", "numeric", "ts")
# vars <- c("None" = "none", varnames()[isNum])
# if (isTRUE(input$qib_comby) && length(input$qib_yvar) > 1) vars <- c("None" = "none")
# selectizeInput(
# "qib_size", i18n$t("Size:"), vars,
# multiple = FALSE,
# selected = state_single("qib_size", vars, init = "none")
# )
# })
output$ui_qib_axes <- renderUI({
req(input$qib_type)
ind <- 1
if (input$qib_type %in% c("line", "scatter", "surface")) {
ind <- 1:3
} else if (input$qib_type == "dist") {
ind <- c(1:2, 5)
} else if (input$qib_type == "density") {
ind <- 1:2
} else if (input$qib_type %in% c("bar", "box")) {
ind <- c(1, 3)
}
if (!is.empty(input$qib_facet_row, ".") || !is.empty(input$qib_facet_col, ".")) ind <- c(ind, 4)
if (input$qib_type == "bar") ind <- c(ind, 6)
checkboxGroupInput(
"qib_axes", NULL, qib_axes[ind],
selected = state_group("qib_axes", ""),
inline = TRUE
)
})
output$ui_qib_check <- renderUI({
req(input$qib_type)
if (input$qib_type == "scatter") {
ind <- 1:3
} else if (input$qib_type == "box") {
ind <- 3
} else if (input$qib_type == "surface") {
ind <- 4
} else {
ind <- c()
}
if (!input$qib_type %in% c("scatter", "box")) {
r_state$qib_check <<- gsub("jitter", "", r_state$qib_check)
}
if (input$qib_type != "scatter") {
r_state$qib_check <<- gsub("line", "", r_state$qib_check)
r_state$qib_check <<- gsub("loess", "", r_state$qib_check)
}
checkboxGroupInput(
"qib_check", NULL, qib_check[ind],
selected = state_group("qib_check", ""),
inline = TRUE
)
})
output$ui_qib_run <- renderUI({
req(input$dataset)
actionButton("qib_run", i18n$t("OneClick chart generation"), width = "100%", icon = icon("play", verify_fa = FALSE), class = "btn-success")
})
# output$ui_qib_labs <- renderUI({
# ## updates when dataset changes
# req(input$dataset)
# wellPanel(
# textAreaInput("qib_labs_title", NULL, "", placeholder = i18n$t("Title"), rows = 1),
# textAreaInput("qib_labs_subtitle", NULL, "", placeholder = i18n$t("Subtitle"), rows = 1),
# textAreaInput("qib_labs_caption", NULL, "", placeholder = i18n$t("Caption"), rows = 1),
# textAreaInput("qib_labs_y", NULL, "", placeholder = i18n$t("Y-label"), rows = 1),
# textAreaInput("qib_labs_x", NULL, "", placeholder = i18n$t("X-label"), rows = 1)
# )
# })
output$ui_qib_colors <- renderUI({
tagList(
conditionalPanel(
condition = "input.qib_type == 'bar' ||
input.qib_type == 'dist' ||
input.qib_type == 'box' ||
input.qib_type == 'density'",
selectInput(
"qib_fillcol", i18n$t("Fill color:"),
choices = colors(),
selected = state_single("qib_fillcol", colors(), "blue")
)
),
conditionalPanel(
condition = "input.qib_type == 'dist' ||
input.qib_type == 'density' ||
input.qib_type == 'box' ||
input.qib_type == 'scatter' ||
input.qib_type == 'line'",
selectInput(
"qib_linecol", i18n$t("Line color:"),
choices = colors(),
selected = state_single("qib_linecol", colors(), "black")
)
),
conditionalPanel(
condition = "input.qib_type == 'scatter' ||
input.qib_type == 'line' ||
input.qib_type == 'box'",
selectInput(
"qib_pointcol", i18n$t("Point color:"),
choices = colors(),
selected = state_single("qib_pointcol", colors(), "black")
)
)
)
})
run_refresh(
qib_args, "qib",
init = c("xvar", "yvar"), label = i18n$t("OneClick chart generation"), relabel = i18n$t("Update plot"),
inputs = c("labs_title", "labs_subtitle", "labs_caption", "labs_y", "labs_x")
)
output$ui_quickgen_basic <- renderUI({
tagList(
wellPanel(
uiOutput("ui_qgb_run")
),
checkboxInput("qgb_details_table", i18n$t("Table"), state_init("qgb_details_table", FALSE)),
conditionalPanel(
"input.qgb_details_table == true",
wellPanel(
uiOutput("ui_qgb_vars"),
uiOutput("ui_qgb_byvar"),
uiOutput("ui_qgb_top"),
# returnTextAreaInput("qgb_tab_slice",
# label = i18n$t("Table slice (rows):"),
# rows = 1,
# value = state_init("qgb_tab_slice"),
# placeholder = i18n$t("e.g., 1:5 and press return")
# ),
uiOutput("ui_qgb_fun"),
numericInput("qgb_dec", label = i18n$t("Decimals:"), value = state_init("qgb_dec", 3), min = 0),
tags$table(
tags$td(uiOutput("ui_qgb_name")),
tags$td(actionButton("qgb_store", i18n$t("Store"), icon = icon("plus", verify_fa = FALSE)), class = "top")
)
),
),
wellPanel(
uiOutput("ui_qib_run")
),
checkboxInput("qib_details_chart", i18n$t("Chart"), state_init("qib_details_chart", FALSE)),
conditionalPanel(
"input.qib_details_chart == true",
wellPanel(
uiOutput("ui_qib_type"),
conditionalPanel(
"input.qib_type == 'scatter'",
uiOutput("ui_qib_nrobs")
),
conditionalPanel(
condition = "input.qib_type != 'dist' && input.qib_type != 'density'",
uiOutput("ui_qib_yvar"),
conditionalPanel(
"input.qib_yvar != undefined && input.qib_yvar != null && input.qib_yvar.length > 1",
uiOutput("ui_qib_comby")
)
),
uiOutput("ui_qib_xvar"),
conditionalPanel(
"input.qib_type == 'dist' || input.qib_type == 'density'",
conditionalPanel(
"input.qib_xvar != undefined && input.qib_xvar != null && input.qib_xvar.length > 1",
uiOutput("ui_qib_combx")
)
),
# uiOutput("ui_qib_facet_row"),
# uiOutput("ui_qib_facet_col"),
# conditionalPanel(
# condition = "input.qib_type == 'bar' ||
# input.qib_type == 'dist' ||
# input.qib_type == 'density' ||
# input.qib_type == 'surface'",
# uiOutput("ui_qib_fill")
# ),
# conditionalPanel(
# condition = "input.qib_type == 'scatter' ||
# input.qib_type == 'line' ||
# input.qib_type == 'box'",
# uiOutput("ui_qib_color")
# ),
# conditionalPanel(
# condition = "input.qib_type == 'scatter'",
# uiOutput("ui_qib_size")
# ),
conditionalPanel(
condition = "input.qib_type == 'bar' ||
input.qib_type == 'scatter' ||
input.qib_type == 'line'",
selectInput(
"qib_fun", i18n$t("Function:"),
choices = getOption("radiant.functions"),
selected = state_single("qib_fun", getOption("radiant.functions"), "mean")
)
),
# conditionalPanel(
# condition = "input.qib_type == 'scatter' ||
# input.qib_type == 'line' ||
# input.qib_type == 'surface' ||
# input.qib_type == 'box'",
# uiOutput("ui_qib_check")
# ),
# uiOutput("ui_qib_axes"),
conditionalPanel(
condition = "input.qib_type == 'dist'",
sliderInput(
"qib_bins",
label = i18n$t("Number of bins:"),
value = state_init("qib_bins", 10),
min = 2, max = 50, step = 1
)
),
conditionalPanel(
"input.qib_type == 'density' ||
input.qib_type == 'dist' && (input.qib_axes && input.qib_axes.indexOf('density')) >= 0 ||
(input.qib_type == 'scatter' && (input.qib_check && input.qib_check.indexOf('loess') >= 0))",
sliderInput(
"qib_smooth",
label = i18n$t("Smooth:"),
value = state_init("qib_smooth", 1),
min = 0.1, max = 3, step = .1
)
)
)
),
# checkboxInput("qib_details_labels", i18n$t("Labels"), state_init("qib_details_labels", FALSE)),
# conditionalPanel(
# "input.qib_details_labels == true",
# uiOutput("ui_qib_labs")
# ),
checkboxInput("qib_details_style", i18n$t("Style"), state_init("qib_details_style", FALSE)),
conditionalPanel(
"input.qib_details_style == true",
wellPanel(
selectInput(
"qib_theme", i18n$t("Plot theme:"),
choices = qib_theme,
selected = state_single("qib_theme", qib_theme, "theme_gray")
),
numericInput(
"qib_base_size", i18n$t("Base font size:"),
value = state_init("qib_base_size", 11)
),
selectInput(
"qib_base_family", i18n$t("Font family:"),
choices = qib_base_family,
selected = state_single("qib_base_family", qib_base_family, "helvetica")
),
uiOutput("ui_qib_colors"),
sliderInput(
"qib_alpha",
label = i18n$t("Opacity:"),
value = state_init("qib_alpha", .5),
min = 0, max = 1, step = .01
),
tags$table(
tags$td(
numericInput(
"qib_plot_height",
label = i18n$t("Plot height:"), min = 100,
max = 2000, step = 50,
value = state_init("qib_plot_height", r_info[["plot_height"]]),
width = "117px"
)
),
tags$td(
numericInput(
"qib_plot_width",
label = i18n$t("Plot width:"), min = 100,
max = 2000, step = 50,
value = state_init("qib_plot_width", r_info[["plot_width"]]),
width = "117px"
),
width = "100%"
)
)
)
),
help_and_report(
modal_title = i18n$t("Generate descriptive statistics with one click"), fun_name = "quickgen_basic",
help_file = inclMD(file.path(getOption("radiant.path.quickgen"), "app/tools/help/quickgen_basic.md")),
lic = "by-sa"
)
)
})
qib_plot_width <- reactive({
if (is.empty(input$qib_plot_width)) r_info[["plot_width"]] else input$qib_plot_width
})
qib_plot_height <- eventReactive(
{
input$qib_run
input$qib_plot_height
input$qib_plot_width
},
{
if (is.empty(input$qib_plot_height)) {
r_info[["plot_height"]]
} else {
lx <- ifelse(not_available(input$qib_xvar) || isTRUE(input$qib_combx), 1, length(input$qib_xvar))
ly <- ifelse(not_available(input$qib_yvar) || input$qib_type %in% c("dist", "density") ||
isTRUE(input$qib_comby), 1, length(input$qib_yvar))
nr <- lx * ly
if (nr > 1) {
(input$qib_plot_height / 2) * ceiling(nr / 2)
} else {
input$qib_plot_height
}
}
}
)
.quickgen <- eventReactive(input$qgb_run, {
if (not_available(input$qgb_vars) || is.null(input$qgb_top)) {
return()
} else if (!is.empty(input$qgb_byvar) && not_available(input$qgb_byvar)) {
return()
} else if (available(input$qgb_byvar) && any(input$qgb_byvar %in% input$qgb_vars)) {
return()
}
qgbi <- qgb_inputs()
qgbi$envir <- r_data
sshhr(do.call(explore, qgbi))
})
observeEvent(input$qgb_search_columns, {
r_state$qgb_search_columns <<- input$qgb_search_columns
})
observeEvent(input$qgb_state, {
r_state$qgb_state <<- input$qgb_state
})
qgb_reset <- function(var, ncol) {
if (!identical(r_state[[var]], input[[var]])) {
r_state[[var]] <<- input[[var]]
r_state$qgb_state <<- list()
r_state$qgb_search_columns <<- rep("", ncol)
}
}
output$qgb_tab <- DT::renderDataTable({
input$qgb_run
withProgress(message = i18n$t("Generating explore table"), value = 1, {
isolate({
qgb <- .quickgen()
req(!is.null(qgb))
qgb$shiny <- TRUE
## resetting DT when changes occur
nc <- ncol(qgb$tab)
qgb_reset("qgb_vars", nc)
qgb_reset("qgb_byvar", nc)
qgb_reset("qgb_fun", nc)
if (!is.null(r_state$qgb_top) &&
!is.null(input$qgb_top) &&
!identical(r_state$qgb_top, input$qgb_top)) {
r_state$qgb_top <<- input$qgb_top
r_state$qgb_state <<- list()
r_state$qgb_search_columns <<- rep("", nc)
}
searchCols <- lapply(r_state$qgb_search_columns, function(x) list(search = x))
order <- r_state$qgb_state$order
pageLength <- r_state$qgb_state$length
})
caption <- if (is.empty(input$qgb_tab_slice)) NULL else glue("Table slice {input$expl_tab_slice} will be applied on Download, Store, or Report")
dtab(
qgb,
dec = input$qgb_dec, searchCols = searchCols, order = order,
pageLength = pageLength,
caption = caption
)
})
})
dl_qgb_tab <- function(path) {
dat <- try(.quickgen(), silent = TRUE)
if (inherits(dat, "try-error") || is.null(dat)) {
write.csv(tibble::tibble("Data" = "[Empty]"), path, row.names = FALSE)
return()
}
rows <- input$qgb_rows_all
tmp <- if (is.null(rows)) dat$tab else dat$tab[rows, , drop = FALSE]
if (is.null(tmp) || nrow(tmp) == 0) {
write.csv(tibble::tibble("Data" = "[Empty]"), path, row.names = FALSE)
} else {
write.csv(tmp, path, row.names = FALSE)
}
}
output$qib_chart <- renderPlot(
{
req(input$qib_type)
if (not_available(input$qib_xvar)) {
if (!input$qib_type %in% c("box", "line")) {
return(
plot(
x = 1, type = "n",
main = " ",
axes = FALSE, xlab = "", ylab = "", cex.main = .9
)
)
}
}
.qib_chart() %>%
(function(x) {
if (is.empty(x) || is.character(x)) {
plot(x = 1, type = "n", main = paste0("\n", x), axes = FALSE, xlab = "", ylab = "", cex.main = .9)
} else if (length(x) > 0) {
print(x)
}
})
},
width = qib_plot_width,
height = qib_plot_height,
res = 96
)
.qib_chart <- eventReactive(input$qib_run, {
req(input$qib_type)
if (input$qib_type == "scatter") req(input$qib_nrobs)
## need dependency on ..
req(input$qib_plot_height && input$qib_plot_width)
if (not_available(input$qib_xvar) && !input$qib_type %in% c("box", "line")) {
return()
} else if (input$qib_type %in% c("scatter", "line", "box", "bar", "surface") && not_available(input$qib_yvar)) {
return(i18n$t("No Y-variable provided for a plot that requires one"))
} else if (input$qib_type == "box" && !all(input$qib_xvar %in% groupable_vars())) {
return()
}
## waiting for comby and/or combx to be updated
if (input$qib_type %in% c("dist", "density")) {
if (isTRUE(input$qib_comby)) {
return()
}
if (length(input$qib_xvar) > 1 && is.null(input$qib_combx)) {
return()
}
} else {
if (isTRUE(input$qib_combx)) {
return()
}
if (length(input$qib_yvar) > 1 && is.null(input$qib_comby)) {
return()
}
}
#req(!is.null(input$qib_color) || !is.null(input$qib_fill))
qibi <- qib_inputs()
qibi$dataset <- input$dataset
qibi$shiny <- TRUE
qibi$envir <- r_data
qibi$color <- "none"
qibi$fill <- "none"
qibi$facet_row <- "."
qibi$facet_col <- "."
withProgress(message = i18n$t("Making plot"), value = 1, {
do.call(visualize, qibi)
})
})
observeEvent(input$qgb_store, {
req(input$qgb_name)
dat <- .quickgen()
if (is.null(dat)) {
return()
}
dataset <- fix_names(input$qgb_name)
if (input$qgb_name != dataset) {
updateTextInput(session, inputId = "qgb_name", value = dataset)
}
rows <- input$qgb_rows_all
tmp <- if (is.null(rows)) dat$tab else dat$tab[rows, , drop = FALSE]
r_data[[dataset]] <- tmp
register(dataset)
updateSelectInput(session, "dataset", selected = input$dataset)
showModal(
modalDialog(
title = i18n$t("Data Stored"),
span(
i18n$t("Dataset was successfully added to the datasets dropdown. Add code to Report > Rmd or Report > R to (re)create the results by clicking the report icon on the bottom left of your screen.")
),
footer = modalButton(i18n$t("OK")),
size = "m",
easyClose = TRUE
)
)
})
qgb_report <- function() {
## get the state of the dt table
ts <- dt_state("qgb_tab")
xcmd <- "# summary(result)\ndtab(result"
if (!is.empty(input$qgb_dec, 3)) {
xcmd <- paste0(xcmd, ", dec = ", input$qgb_dec)
}
if (!is.empty(r_state$qgb_state$length, 10)) {
xcmd <- paste0(xcmd, ", pageLength = ", r_state$qgb_state$length)
}
xcmd <- paste0(xcmd, ", caption = \"\") %>% render()")
if (!is.empty(input$qgb_name)) {
dataset <- fix_names(input$qgb_name)
if (input$qgb_name != dataset) {
updateTextInput(session, inputId = "qgb_name", value = dataset)
}
xcmd <- paste0(xcmd, "\n", dataset, " <- result$tab\nregister(\"", dataset, "\")")
}
inp_main <- clean_args(qgb_inputs(), qgb_args)
if (ts$tabsort != "") inp_main <- c(inp_main, tabsort = ts$tabsort)
if (ts$tabfilt != "") inp_main <- c(inp_main, tabfilt = ts$tabfilt)
if (is.empty(inp_main$rows)) {
inp_main$rows <- NULL
}
if (is.empty(input$qgb_tab_slice)) {
inp_main <- c(inp_main, nr = Inf)
} else {
inp_main$tabslice <- input$qgb_tab_slice
}
inp_out <- list(clean_args(qgb_sum_inputs(), qgb_sum_args[-1]))
update_report(
inp_main = inp_main,
fun_name = "qgb",
inp_out = inp_out,
outputs = c(),
figs = FALSE,
xcmd = xcmd
)
}
qib_report <- function() {
## resetting hidden elements to default values
vi <- qib_inputs()
if (input$qib_type != "dist") {
vi$bins <- qib_args$bins
}
if (input$qib_type %in% c("dist", "density")) {
vi$yvar <- qib_args$yvar
}
if (!input$qib_type %in% c("density", "scatter", "dist") ||
!("loess" %in% input$qib_check || "density" %in% input$qib_axes || input$qib_type == "density")) {
vi$smooth <- qib_args$smooth
}
if (!input$qib_type %in% c("scatter", "box") && "jitter" %in% input$qib_check) {
vi$check <- base::setdiff(vi$check, "jitter")
}
if (input$qib_type != "scatter") {
vi$size <- "none"
vi$nrobs <- NULL
} else {
vi$nrobs <- as_integer(vi$nrobs)
}
if (!input$qib_type %in% c("scatter", "line", "box")) {
vi$color <- NULL
}
if (!input$qib_type %in% c("bar", "dist", "density", "surface")) {
vi$fill <- NULL
}
if (!input$qib_type %in% c("bar", "dist", "box", "density")) {
vi$fillcol <- "blue"
}
if (!input$qib_type %in% c("dist", "density", "box", "scatter", "line")) {
vi$linecol <- "black"
}
if (!input$qib_type %in% c("box", "scatter", "line")) {
vi$pointcol <- "black"
}
if (!input$qib_type %in% c("bar", "line", "scatter")) {
vi$fun <- "mean"
}
if (is.empty(input$data_rows)) {
vi$rows <- NULL
}
inp_main <- c(clean_args(vi, qib_args), custom = FALSE)
update_report(
inp_main = inp_main,
fun_name = "qib_chart",
outputs = character(0),
pre_cmd = "",
figs = TRUE,
fig.width = qib_plot_width(),
fig.height = qib_plot_height()
)
}
download_handler(
id = "dl_qgb_tab",
fun = dl_qgb_tab,
fn = function() paste0(input$dataset, "_tab"),
type = "csv"
)
download_handler(
id = "dlp_qib_chart",
fun = download_handler_plot,
fn = function() paste0(input$dataset, "_chart"),
type = "png",
caption = i18n$t("Save visualize plot"),
plot = .qib_chart,
width = qib_plot_width,
height = qib_plot_height
)
observeEvent(input$qgb_report, {
r_info[["latest_screenshot"]] <- NULL
qgb_report()
})
observeEvent(input$qgb_screenshot, {
r_info[["latest_screenshot"]] <- NULL
radiant_screenshot_modal("modal_qgb_screenshot")
})
observeEvent(input$modal_qgb_screenshot, {
qgb_report()
removeModal()
})
observeEvent(input$qib_report, {
r_info[["latest_screenshot"]] <- NULL
qib_report()
})
observeEvent(input$qib_screenshot, {
r_info[["latest_screenshot"]] <- NULL
radiant_screenshot_modal("modal_qib_screenshot")
})
observeEvent(input$modal_qib_screenshot, {
qib_report()
removeModal()
})
# 全选功能
observeEvent(input$qgb_select_all, {
r_funs <- getOption("radiant.functions")
if (!is.null(r_funs)) {
updateCheckboxGroupInput(session, "qgb_fun", selected = r_funs)
}
})
# 全不选功能
observeEvent(input$qgb_deselect_all, {
updateCheckboxGroupInput(session, "qgb_fun", selected = character(0))
})
# 反选功能
observeEvent(input$qgb_invert_selection, {
current <- input$qgb_fun %||% character(0)
r_funs <- getOption("radiant.functions")
if (!is.null(r_funs)) {
new_selection <- setdiff(r_funs, current)
updateCheckboxGroupInput(session, "qgb_fun", selected = new_selection)
}
})
output$quickgen_basic <- renderUI({
stat_tab_panel(
menu = i18n$t("Oneclick generation > Generate descriptive statistics"),
tool = i18n$t("Generate descriptive statistics with one click"),
tool_ui = "ui_quickgen_basic",
output_panels = tagList(
tabPanel(
title = i18n$t("Table"),
download_link("dl_qgb_tab"),br(),
DT::dataTableOutput("qgb_tab"),
tags$hr(),
htmlOutput("qgb_desc_text", inline = FALSE)
),
tabPanel(
title = i18n$t("Chart"),
download_link("dlp_qib_chart"), br(),
plotOutput("qib_chart", width = "100%", height = "auto"),
tags$hr(),
htmlOutput("qib_desc_text", inline = FALSE)
)
)
)
})
## ---------- 表格的描述文字 ----------
output$qgb_desc_text <- renderUI({
dat <- tryCatch(.quickgen(), error = function(e) NULL)
txt <- if (!is.null(dat) && !is.null(dat$tab)) {
make_desc_text(dat$tab)
} else {
" "
}
HTML(markdown::markdownToHTML(text = txt, fragment.only = TRUE))
})
## ---------- 图表的描述文字 ----------
output$qib_desc_text <- renderUI({
df <- tryCatch({
qibi <- qib_inputs()
qibi$envir <- r_data
qibi$dataset <- input$dataset
qibi$shiny <- TRUE
res <- do.call(visualize, qibi)
res$data
}, error = function(e) NULL)
txt <- if (!is.null(df)) make_desc_text(df) else " "
HTML(markdown::markdownToHTML(text = txt, fragment.only = TRUE))
})
\ No newline at end of file
make_desc_text <- function(df) {
if (is.null(df) || nrow(df) == 0) return(i18n$t("No data available"))
num_cols <- sapply(df, is.numeric)
if (sum(num_cols) == 0) return("No numerical variable available")
df_num <- df[, num_cols, drop = FALSE]
buf <- c(i18n$t("### Current data overview"))
buf <- c(buf, sprintf("- **Sample size**:%d records", nrow(df)))
## 连续变量
for (v in names(df_num)) {
x <- df_num[[v]]
x <- x[!is.na(x)]
if (length(x) == 0) next
buf <- c(buf, sprintf(
"- **%s**: mean %.2f ± %.2f; median %.2f; range [%.2f, %.2f]; missing %.1f%%",
v,
mean(x), sd(x), median(x), min(x), max(x),
100 * (1 - length(x) / nrow(df))
))
}
## 分类变量
cat_cols <- sapply(df, function(z) is.factor(z) || is.character(z))
for (v in names(df)[cat_cols]) {
tbl <- table(df[[v]], useNA = "ifany")
lev_txt <- paste(sprintf("%s (%d, %.1f%%)",
names(tbl), tbl,
100 * tbl / sum(tbl)), collapse = "、")
buf <- c(buf, sprintf("- **%s**:%s", v, lev_txt))
}
paste(buf, collapse = "\n")
}
## quickgen_basic 的形参列表
default_funs <- c("n_obs", "mean", "sd", "min", "max")
qib_type <- c(
"分布图(dist)" = "dist", "密度图(density)" = "density", "散点图(scatter)" = "scatter",
"曲面图(surface)" = "surface", "折线图(line)" = "line", "条形图(bar)" = "bar", "箱线图(box)" = "box"
)
qib_check <- c(
"直线(line)" = "line", "局部加权回归(loess)" = "loess",
"抖动(jitter)" = "jitter",
"插值(interpolate)" = "interpolate"
)
qib_axes <- c(
"翻转坐标轴(flip)" = "flip", "X轴对数变换(log_x)" = "log_x", "Y轴对数变换(log_y)" = "log_y",
"Y轴缩放(scale_y)" = "scale_y", "密度(density)" = "density", "排序(sort)" = "sort"
)
qib_theme <- c(
"灰色主题(gray)" = "theme_gray", "黑白主题(bw)" = "theme_bw",
"明亮主题(light)" = "theme_light", "暗黑主题(dark)" = "theme_dark",
"极简主题(minimal)" = "theme_minimal", "经典主题(classic)" = "theme_classic"
)
os_type <- Sys.info()["sysname"]
if (os_type == "Windows") {
fnt <- names(windowsFonts())
names(fnt) <- tools::toTitleCase(fnt)
qib_base_family <- c("Theme default" = "", fnt)
} else {
qib_base_family <- c(
"Theme default" = "", "Helvetica" = "Helvetica", "Serif" = "serif",
"Sans" = "sans", "Mono" = "mono", "Courier" = "Courier", "Times" = "Times"
)
}
qib_labs <- c(i18n$t("title"), i18n$t("subtitle"), i18n$t("caption"), i18n$t("x"), i18n$t("y"))
qib_add_labs <- function() {
lab_list <- list()
for (l in qib_labs) {
inp <- input[[paste0("qib_labs_", l)]]
if (!is.empty(inp)) lab_list[[l]] <- inp
}
lab_list
}
qgb_args <- as.list(formals(explore))
qib_args <- as.list(formals(visualize))
## 收集用户输入的 reactive 列表
qgb_inputs <- reactive({
qgb_args$data_filter <- if (input$show_filter) input$data_filter else ""
qgb_args$arr <- if (input$show_filter) input$data_arrange else ""
qgb_args$rows <- if (input$show_filter) input$data_rows else ""
qgb_args$dataset <- input$dataset
for (i in r_drop(names(qgb_args))) {
qgb_args[[i]] <- input[[paste0("qgb_", i)]]
}
qgb_args
})
qgb_sum_args <- as.list(if (exists("summary.explore")) {
formals(summary.explore)
} else {
formals(radiant.data:::summary.explore)
})
qib_inputs <- reactive({
qib_args$data_filter <- if (isTRUE(input$show_filter)) input$data_filter else ""
qib_args$arr <- if (isTRUE(input$show_filter)) input$data_arrange else ""
qib_args$rows <- if (isTRUE(input$show_filter)) input$data_rows else ""
qib_args$dataset <- input$dataset
qib_args$shiny <- input$shiny
qib_args$labs <- qib_add_labs()
for (i in r_drop(names(qib_args), drop = c(i18n$t("dataset"), i18n$t("data_filter"), i18n$t("arr"), i18n$t("rows"), i18n$t("labs")))) {
qib_args[[i]] <- input[[paste0("qib_", i)]]
}
qib_args
})
## list of function inputs selected by user
qgb_sum_inputs <- reactive({
## loop needed because reactive values don't allow single bracket indexing
for (i in names(qgb_sum_args)) {
qgb_sum_args[[i]] <- input[[paste0("qgb_", i)]]
}
qgb_sum_args
})
## UI-elements
output$ui_qgb_vars <- renderUI({
vars <- varnames()
req(available(vars))
selectizeInput(
"qgb_vars",
label = i18n$t("Numeric variable(s):"),
choices = vars,
selected = state_multiple("qgb_vars", vars, isolate(input$qgb_vars)),
multiple = TRUE,
options = list(
placeholder = i18n$t("Select numeric variables"),
plugins = list("remove_button", "drag_drop")
)
)
})
output$ui_qgb_byvar <- renderUI({
withProgress(message = i18n$t("Acquiring variable information"), value = 1, {
vars <- groupable_vars()
})
req(available(vars))
if (any(vars %in% input$qgb_vars)) {
vars <- base::setdiff(vars, input$qgb_vars)
names(vars) <- varnames() %>%
(function(x) x[match(vars, x)]) %>%
names()
}
isolate({
## if nothing is selected expl_byvar is also null
if ("qgb_byvar" %in% names(input) && is.null(input$qgb_byvar)) {
r_state$qgb_byvar <<- NULL
} else {
if (available(r_state$qgb_byvar) && all(r_state$qgb_byvar %in% vars)) {
vars <- unique(c(r_state$qgb_byvar, vars))
names(vars) <- varnames() %>%
(function(x) x[match(vars, x)]) %>%
names()
}
}
})
selectizeInput(
"qgb_byvar",
label = i18n$t("Group by:"), choices = vars,
selected = state_multiple("qgb_byvar", vars, isolate(input$qgb_byvar)),
multiple = TRUE,
options = list(
placeholder = i18n$t("Select group-by variable"),
plugins = list("remove_button", "drag_drop")
)
)
})
output$ui_qgb_fun <- renderUI({
r_funs <- getOption("radiant.functions")
selected <- isolate(
if (is.empty(input$qgb_fun)) default_funs else input$qgb_fun
)
tagList(
div(
style = "margin-top: 5px; display: flex; gap: 3px; flex-wrap: wrap;",
actionButton("qgb_select_all", i18n$t("Select All"),
class = "btn-xs btn-primary", icon = icon("check-square")),
actionButton("qgb_deselect_all", i18n$t("Deselect All"),
class = "btn-xs btn-primary", icon = icon("square")),
actionButton("qgb_invert_selection", i18n$t("Invert"),
class = "btn-xs btn-primary", icon = icon("undo"))
),
checkboxGroupInput(
inputId = "qgb_fun",
label = i18n$t("Apply function(s):"),
choices = r_funs,
selected = selected
)
)
})
output$ui_qgb_top <- renderUI({
if (is.empty(input$qgb_vars)) {
return()
}
top_var <- setNames(
c("fun", "var", "byvar"),
c(i18n$t("Function"), i18n$t("Variables"), i18n$t("Group by"))
)
if (is.empty(input$qgb_byvar)) top_var <- top_var[1:2]
selectizeInput(
"qgb_top",
label = i18n$t("Column header:"),
choices = top_var,
selected = state_single("qgb_top", top_var, isolate(input$qgb_top)),
multiple = FALSE
)
})
output$ui_qgb_name <- renderUI({
req(input$dataset)
textInput("qgb_name", i18n$t("Store as:"), "", placeholder = i18n$t("Provide a table name"))
})
output$ui_qgb_run <- renderUI({
## updates when dataset changes
req(input$dataset)
actionButton("qgb_run", i18n$t("OneClick table generation"), width = "100%", icon = icon("play", verify_fa = FALSE), class = "btn-success")
})
## add a spinning refresh icon if the table needs to be (re)calculated
run_refresh(qgb_args, "qgb", init = "vars", label = i18n$t("OneClick table generation"), relabel = i18n$t("Update table"))
#######################################
# Visualize data
#######################################
output$ui_qib_type <- renderUI({
selectInput(
inputId = "qib_type", label = i18n$t("Plot-type:"), choices = qib_type,
selected = state_single("qib_type", qib_type),
multiple = FALSE
)
})
output$ui_qib_nrobs <- renderUI({
req(input$qib_type == "scatter")
nrobs <- nrow(.get_data())
choices <- c("1,000" = 1000, "5,000" = 5000, "10,000" = 10000, "All" = -1) %>%
.[. < nrobs]
selectInput(
"qib_nrobs", i18n$t("Number of data points plotted:"),
choices = choices,
selected = state_single("qib_nrobs", choices, 1000)
)
})
## Y - variable
output$ui_qib_yvar <- renderUI({
req(input$qib_type)
vars <- varying_vars()
req(available(vars))
vars <- vars["date" != .get_class()[vars]]
if (input$qib_type %in% c("line", "bar", "scatter", "surface", "box")) {
vars <- vars["character" != .get_class()[vars]]
}
if (input$qib_type %in% c("box", "scatter")) {
vars <- vars["factor" != .get_class()[vars]]
}
selectizeInput(
inputId = "qib_yvar",
label = i18n$t("Y-variable:"),
choices = vars,
selected = state_multiple("qib_yvar", vars, isolate(input$qib_yvar)),
multiple = TRUE,
options = list(
placeholder = i18n$t("Select Y variable(s)"),
plugins = list("remove_button", "drag_drop")
)
)
})
## X - variable
output$ui_qib_xvar <- renderUI({
req(input$qib_type)
vars <- varying_vars()
req(available(vars))
if (input$qib_type == "dist") vars <- vars["date" != .get_class()[vars]]
if (input$qib_type == "density") vars <- vars["factor" != .get_class()[vars]]
if (input$qib_type %in% c("box", "bar")) vars <- groupable_vars_nonum()
selectizeInput(
inputId = "qib_xvar",
label = i18n$t("X-variable:"),
choices = vars,
selected = state_multiple("qib_xvar", vars, isolate(input$qib_xvar)),
multiple = TRUE,
options = list(
placeholder = i18n$t("Select X variable(s)"),
plugins = list("remove_button", "drag_drop")
)
)
})
output$ui_qib_comby <- renderUI({
checkboxInput(
"qib_comby", i18n$t("Combine Y-variables in one plot"),
state_init("qib_comby", FALSE)
)
})
output$ui_qib_combx <- renderUI({
checkboxInput(
"qib_combx", i18n$t("Combine X-variables in one plot"),
state_init("qib_combx", FALSE)
)
})
observeEvent(length(input$qib_xvar) < 2, {
updateCheckboxInput(session, "qib_combx", value = FALSE)
})
observeEvent(length(input$qib_yvar) < 2, {
updateCheckboxInput(session, "qib_comby", value = FALSE)
})
observeEvent(input$qib_type, {
if (input$qib_type %in% c("dist", "density")) {
updateCheckboxInput(session, "qib_comby", value = FALSE)
} else {
updateCheckboxInput(session, "qib_combx", value = FALSE)
}
})
observeEvent(input$qib_check, {
if (!"loess" %in% input$qib_check && input$qib_smooth != 1) {
updateSliderInput(session, "qib_smooth", value = 1)
}
})
# output$ui_qib_facet_row <- renderUI({
# vars <- c("None" = ".", groupable_vars_nonum())
# selectizeInput(
# "qib_facet_row", i18n$t("Facet row:"), vars,
# selected = state_single("qib_facet_row", vars, init = "."),
# multiple = FALSE
# )
# })
# output$ui_qib_facet_col <- renderUI({
# vars <- c("None" = ".", groupable_vars_nonum())
# selectizeInput(
# "qib_facet_col", i18n$t("Facet column:"), vars,
# selected = state_single("qib_facet_col", vars, init = "."),
# multiple = FALSE
# )
# })
# output$ui_qib_color <- renderUI({
# req(input$qib_type)
# if (input$qib_type == "line") {
# vars <- c("None" = "none", groupable_vars())
# } else {
# vars <- c("None" = "none", varnames())
# }
#
# if (isTRUE(input$qib_comby) && length(input$qib_yvar) > 1) vars <- c("None" = "none")
# selectizeInput(
# "qib_color", i18n$t("Color:"), vars,
# multiple = FALSE,
# selected = state_single("qib_color", vars, init = "none")
# )
# })
# output$ui_qib_fill <- renderUI({
# vars <- c("None" = "none", groupable_vars())
# if (isTRUE(input$qib_combx) && length(input$qib_xvar) > 1) vars <- vars[1]
# selectizeInput(
# "qib_fill", i18n$t("Fill:"), vars,
# multiple = FALSE,
# selected = state_single("qib_fill", vars, init = "none")
# )
# })
# output$ui_qib_size <- renderUI({
# req(input$qib_type)
# isNum <- .get_class() %in% c("integer", "numeric", "ts")
# vars <- c("None" = "none", varnames()[isNum])
# if (isTRUE(input$qib_comby) && length(input$qib_yvar) > 1) vars <- c("None" = "none")
# selectizeInput(
# "qib_size", i18n$t("Size:"), vars,
# multiple = FALSE,
# selected = state_single("qib_size", vars, init = "none")
# )
# })
output$ui_qib_axes <- renderUI({
req(input$qib_type)
ind <- 1
if (input$qib_type %in% c("line", "scatter", "surface")) {
ind <- 1:3
} else if (input$qib_type == "dist") {
ind <- c(1:2, 5)
} else if (input$qib_type == "density") {
ind <- 1:2
} else if (input$qib_type %in% c("bar", "box")) {
ind <- c(1, 3)
}
if (!is.empty(input$qib_facet_row, ".") || !is.empty(input$qib_facet_col, ".")) ind <- c(ind, 4)
if (input$qib_type == "bar") ind <- c(ind, 6)
checkboxGroupInput(
"qib_axes", NULL, qib_axes[ind],
selected = state_group("qib_axes", ""),
inline = TRUE
)
})
output$ui_qib_check <- renderUI({
req(input$qib_type)
if (input$qib_type == "scatter") {
ind <- 1:3
} else if (input$qib_type == "box") {
ind <- 3
} else if (input$qib_type == "surface") {
ind <- 4
} else {
ind <- c()
}
if (!input$qib_type %in% c("scatter", "box")) {
r_state$qib_check <<- gsub("jitter", "", r_state$qib_check)
}
if (input$qib_type != "scatter") {
r_state$qib_check <<- gsub("line", "", r_state$qib_check)
r_state$qib_check <<- gsub("loess", "", r_state$qib_check)
}
checkboxGroupInput(
"qib_check", NULL, qib_check[ind],
selected = state_group("qib_check", ""),
inline = TRUE
)
})
output$ui_qib_run <- renderUI({
req(input$dataset)
actionButton("qib_run", i18n$t("OneClick chart generation"), width = "100%", icon = icon("play", verify_fa = FALSE), class = "btn-success")
})
# output$ui_qib_labs <- renderUI({
# ## updates when dataset changes
# req(input$dataset)
# wellPanel(
# textAreaInput("qib_labs_title", NULL, "", placeholder = i18n$t("Title"), rows = 1),
# textAreaInput("qib_labs_subtitle", NULL, "", placeholder = i18n$t("Subtitle"), rows = 1),
# textAreaInput("qib_labs_caption", NULL, "", placeholder = i18n$t("Caption"), rows = 1),
# textAreaInput("qib_labs_y", NULL, "", placeholder = i18n$t("Y-label"), rows = 1),
# textAreaInput("qib_labs_x", NULL, "", placeholder = i18n$t("X-label"), rows = 1)
# )
# })
output$ui_qib_colors <- renderUI({
tagList(
conditionalPanel(
condition = "input.qib_type == 'bar' ||
input.qib_type == 'dist' ||
input.qib_type == 'box' ||
input.qib_type == 'density'",
selectInput(
"qib_fillcol", i18n$t("Fill color:"),
choices = colors(),
selected = state_single("qib_fillcol", colors(), "blue")
)
),
conditionalPanel(
condition = "input.qib_type == 'dist' ||
input.qib_type == 'density' ||
input.qib_type == 'box' ||
input.qib_type == 'scatter' ||
input.qib_type == 'line'",
selectInput(
"qib_linecol", i18n$t("Line color:"),
choices = colors(),
selected = state_single("qib_linecol", colors(), "black")
)
),
conditionalPanel(
condition = "input.qib_type == 'scatter' ||
input.qib_type == 'line' ||
input.qib_type == 'box'",
selectInput(
"qib_pointcol", i18n$t("Point color:"),
choices = colors(),
selected = state_single("qib_pointcol", colors(), "black")
)
)
)
})
run_refresh(
qib_args, "qib",
init = c("xvar", "yvar"), label = i18n$t("OneClick chart generation"), relabel = i18n$t("Update plot"),
inputs = c("labs_title", "labs_subtitle", "labs_caption", "labs_y", "labs_x")
)
output$ui_quickgen_basic <- renderUI({
tagList(
wellPanel(
uiOutput("ui_qgb_run")
),
checkboxInput("qgb_details_table", i18n$t("Table"), state_init("qgb_details_table", FALSE)),
conditionalPanel(
"input.qgb_details_table == true",
wellPanel(
uiOutput("ui_qgb_vars"),
uiOutput("ui_qgb_byvar"),
uiOutput("ui_qgb_top"),
# returnTextAreaInput("qgb_tab_slice",
# label = i18n$t("Table slice (rows):"),
# rows = 1,
# value = state_init("qgb_tab_slice"),
# placeholder = i18n$t("e.g., 1:5 and press return")
# ),
uiOutput("ui_qgb_fun"),
numericInput("qgb_dec", label = i18n$t("Decimals:"), value = state_init("qgb_dec", 3), min = 0),
tags$table(
tags$td(uiOutput("ui_qgb_name")),
tags$td(actionButton("qgb_store", i18n$t("Store"), icon = icon("plus", verify_fa = FALSE)), class = "top")
)
),
),
wellPanel(
uiOutput("ui_qib_run")
),
checkboxInput("qib_details_chart", i18n$t("Chart"), state_init("qib_details_chart", FALSE)),
conditionalPanel(
"input.qib_details_chart == true",
wellPanel(
uiOutput("ui_qib_type"),
conditionalPanel(
"input.qib_type == 'scatter'",
uiOutput("ui_qib_nrobs")
),
conditionalPanel(
condition = "input.qib_type != 'dist' && input.qib_type != 'density'",
uiOutput("ui_qib_yvar"),
conditionalPanel(
"input.qib_yvar != undefined && input.qib_yvar != null && input.qib_yvar.length > 1",
uiOutput("ui_qib_comby")
)
),
uiOutput("ui_qib_xvar"),
conditionalPanel(
"input.qib_type == 'dist' || input.qib_type == 'density'",
conditionalPanel(
"input.qib_xvar != undefined && input.qib_xvar != null && input.qib_xvar.length > 1",
uiOutput("ui_qib_combx")
)
),
# uiOutput("ui_qib_facet_row"),
# uiOutput("ui_qib_facet_col"),
# conditionalPanel(
# condition = "input.qib_type == 'bar' ||
# input.qib_type == 'dist' ||
# input.qib_type == 'density' ||
# input.qib_type == 'surface'",
# uiOutput("ui_qib_fill")
# ),
# conditionalPanel(
# condition = "input.qib_type == 'scatter' ||
# input.qib_type == 'line' ||
# input.qib_type == 'box'",
# uiOutput("ui_qib_color")
# ),
# conditionalPanel(
# condition = "input.qib_type == 'scatter'",
# uiOutput("ui_qib_size")
# ),
conditionalPanel(
condition = "input.qib_type == 'bar' ||
input.qib_type == 'scatter' ||
input.qib_type == 'line'",
selectInput(
"qib_fun", i18n$t("Function:"),
choices = getOption("radiant.functions"),
selected = state_single("qib_fun", getOption("radiant.functions"), "mean")
)
),
# conditionalPanel(
# condition = "input.qib_type == 'scatter' ||
# input.qib_type == 'line' ||
# input.qib_type == 'surface' ||
# input.qib_type == 'box'",
# uiOutput("ui_qib_check")
# ),
# uiOutput("ui_qib_axes"),
conditionalPanel(
condition = "input.qib_type == 'dist'",
sliderInput(
"qib_bins",
label = i18n$t("Number of bins:"),
value = state_init("qib_bins", 10),
min = 2, max = 50, step = 1
)
),
conditionalPanel(
"input.qib_type == 'density' ||
input.qib_type == 'dist' && (input.qib_axes && input.qib_axes.indexOf('density')) >= 0 ||
(input.qib_type == 'scatter' && (input.qib_check && input.qib_check.indexOf('loess') >= 0))",
sliderInput(
"qib_smooth",
label = i18n$t("Smooth:"),
value = state_init("qib_smooth", 1),
min = 0.1, max = 3, step = .1
)
)
)
),
# checkboxInput("qib_details_labels", i18n$t("Labels"), state_init("qib_details_labels", FALSE)),
# conditionalPanel(
# "input.qib_details_labels == true",
# uiOutput("ui_qib_labs")
# ),
checkboxInput("qib_details_style", i18n$t("Style"), state_init("qib_details_style", FALSE)),
conditionalPanel(
"input.qib_details_style == true",
wellPanel(
selectInput(
"qib_theme", i18n$t("Plot theme:"),
choices = qib_theme,
selected = state_single("qib_theme", qib_theme, "theme_gray")
),
numericInput(
"qib_base_size", i18n$t("Base font size:"),
value = state_init("qib_base_size", 11)
),
selectInput(
"qib_base_family", i18n$t("Font family:"),
choices = qib_base_family,
selected = state_single("qib_base_family", qib_base_family, "helvetica")
),
uiOutput("ui_qib_colors"),
sliderInput(
"qib_alpha",
label = i18n$t("Opacity:"),
value = state_init("qib_alpha", .5),
min = 0, max = 1, step = .01
),
tags$table(
tags$td(
numericInput(
"qib_plot_height",
label = i18n$t("Plot height:"), min = 100,
max = 2000, step = 50,
value = state_init("qib_plot_height", r_info[["plot_height"]]),
width = "117px"
)
),
tags$td(
numericInput(
"qib_plot_width",
label = i18n$t("Plot width:"), min = 100,
max = 2000, step = 50,
value = state_init("qib_plot_width", r_info[["plot_width"]]),
width = "117px"
),
width = "100%"
)
)
)
),
help_and_report(
modal_title = i18n$t("Generate descriptive statistics with one click"), fun_name = "quickgen_basic",
help_file = inclMD(file.path(getOption("radiant.path.quickgen"), "app/tools/help/quickgen_basic.md")),
lic = "by-sa"
)
)
})
qib_plot_width <- reactive({
if (is.empty(input$qib_plot_width)) r_info[["plot_width"]] else input$qib_plot_width
})
qib_plot_height <- eventReactive(
{
input$qib_run
input$qib_plot_height
input$qib_plot_width
},
{
if (is.empty(input$qib_plot_height)) {
r_info[["plot_height"]]
} else {
lx <- ifelse(not_available(input$qib_xvar) || isTRUE(input$qib_combx), 1, length(input$qib_xvar))
ly <- ifelse(not_available(input$qib_yvar) || input$qib_type %in% c("dist", "density") ||
isTRUE(input$qib_comby), 1, length(input$qib_yvar))
nr <- lx * ly
if (nr > 1) {
(input$qib_plot_height / 2) * ceiling(nr / 2)
} else {
input$qib_plot_height
}
}
}
)
.quickgen <- eventReactive(input$qgb_run, {
if (not_available(input$qgb_vars) || is.null(input$qgb_top)) {
return()
} else if (!is.empty(input$qgb_byvar) && not_available(input$qgb_byvar)) {
return()
} else if (available(input$qgb_byvar) && any(input$qgb_byvar %in% input$qgb_vars)) {
return()
}
qgbi <- qgb_inputs()
qgbi$envir <- r_data
sshhr(do.call(explore, qgbi))
})
observeEvent(input$qgb_search_columns, {
r_state$qgb_search_columns <<- input$qgb_search_columns
})
observeEvent(input$qgb_state, {
r_state$qgb_state <<- input$qgb_state
})
qgb_reset <- function(var, ncol) {
if (!identical(r_state[[var]], input[[var]])) {
r_state[[var]] <<- input[[var]]
r_state$qgb_state <<- list()
r_state$qgb_search_columns <<- rep("", ncol)
}
}
output$qgb_tab <- DT::renderDataTable({
input$qgb_run
withProgress(message = i18n$t("Generating explore table"), value = 1, {
isolate({
qgb <- .quickgen()
req(!is.null(qgb))
qgb$shiny <- TRUE
## resetting DT when changes occur
nc <- ncol(qgb$tab)
qgb_reset("qgb_vars", nc)
qgb_reset("qgb_byvar", nc)
qgb_reset("qgb_fun", nc)
if (!is.null(r_state$qgb_top) &&
!is.null(input$qgb_top) &&
!identical(r_state$qgb_top, input$qgb_top)) {
r_state$qgb_top <<- input$qgb_top
r_state$qgb_state <<- list()
r_state$qgb_search_columns <<- rep("", nc)
}
searchCols <- lapply(r_state$qgb_search_columns, function(x) list(search = x))
order <- r_state$qgb_state$order
pageLength <- r_state$qgb_state$length
})
caption <- if (is.empty(input$qgb_tab_slice)) NULL else glue("Table slice {input$expl_tab_slice} will be applied on Download, Store, or Report")
dtab(
qgb,
dec = input$qgb_dec, searchCols = searchCols, order = order,
pageLength = pageLength,
caption = caption
)
})
})
dl_qgb_tab <- function(path) {
dat <- try(.quickgen(), silent = TRUE)
if (inherits(dat, "try-error") || is.null(dat)) {
write.csv(tibble::tibble("Data" = "[Empty]"), path, row.names = FALSE)
return()
}
rows <- input$qgb_rows_all
tmp <- if (is.null(rows)) dat$tab else dat$tab[rows, , drop = FALSE]
if (is.null(tmp) || nrow(tmp) == 0) {
write.csv(tibble::tibble("Data" = "[Empty]"), path, row.names = FALSE)
} else {
write.csv(tmp, path, row.names = FALSE)
}
}
output$qib_chart <- renderPlot(
{
req(input$qib_type)
if (not_available(input$qib_xvar)) {
if (!input$qib_type %in% c("box", "line")) {
return(
plot(
x = 1, type = "n",
main = " ",
axes = FALSE, xlab = "", ylab = "", cex.main = .9
)
)
}
}
.qib_chart() %>%
(function(x) {
if (is.empty(x) || is.character(x)) {
plot(x = 1, type = "n", main = paste0("\n", x), axes = FALSE, xlab = "", ylab = "", cex.main = .9)
} else if (length(x) > 0) {
print(x)
}
})
},
width = qib_plot_width,
height = qib_plot_height,
res = 96
)
.qib_chart <- eventReactive(input$qib_run, {
req(input$qib_type)
if (input$qib_type == "scatter") req(input$qib_nrobs)
## need dependency on ..
req(input$qib_plot_height && input$qib_plot_width)
if (not_available(input$qib_xvar) && !input$qib_type %in% c("box", "line")) {
return()
} else if (input$qib_type %in% c("scatter", "line", "box", "bar", "surface") && not_available(input$qib_yvar)) {
return(i18n$t("No Y-variable provided for a plot that requires one"))
} else if (input$qib_type == "box" && !all(input$qib_xvar %in% groupable_vars())) {
return()
}
## waiting for comby and/or combx to be updated
if (input$qib_type %in% c("dist", "density")) {
if (isTRUE(input$qib_comby)) {
return()
}
if (length(input$qib_xvar) > 1 && is.null(input$qib_combx)) {
return()
}
} else {
if (isTRUE(input$qib_combx)) {
return()
}
if (length(input$qib_yvar) > 1 && is.null(input$qib_comby)) {
return()
}
}
#req(!is.null(input$qib_color) || !is.null(input$qib_fill))
qibi <- qib_inputs()
qibi$dataset <- input$dataset
qibi$shiny <- TRUE
qibi$envir <- r_data
qibi$color <- "none"
qibi$fill <- "none"
qibi$facet_row <- "."
qibi$facet_col <- "."
withProgress(message = i18n$t("Making plot"), value = 1, {
do.call(visualize, qibi)
})
})
observeEvent(input$qgb_store, {
req(input$qgb_name)
dat <- .quickgen()
if (is.null(dat)) {
return()
}
dataset <- fix_names(input$qgb_name)
if (input$qgb_name != dataset) {
updateTextInput(session, inputId = "qgb_name", value = dataset)
}
rows <- input$qgb_rows_all
tmp <- if (is.null(rows)) dat$tab else dat$tab[rows, , drop = FALSE]
r_data[[dataset]] <- tmp
register(dataset)
updateSelectInput(session, "dataset", selected = input$dataset)
showModal(
modalDialog(
title = i18n$t("Data Stored"),
span(
i18n$t("Dataset was successfully added to the datasets dropdown. Add code to Report > Rmd or Report > R to (re)create the results by clicking the report icon on the bottom left of your screen.")
),
footer = modalButton(i18n$t("OK")),
size = "m",
easyClose = TRUE
)
)
})
qgb_report <- function() {
## get the state of the dt table
ts <- dt_state("qgb_tab")
xcmd <- "# summary(result)\ndtab(result"
if (!is.empty(input$qgb_dec, 3)) {
xcmd <- paste0(xcmd, ", dec = ", input$qgb_dec)
}
if (!is.empty(r_state$qgb_state$length, 10)) {
xcmd <- paste0(xcmd, ", pageLength = ", r_state$qgb_state$length)
}
xcmd <- paste0(xcmd, ", caption = \"\") %>% render()")
if (!is.empty(input$qgb_name)) {
dataset <- fix_names(input$qgb_name)
if (input$qgb_name != dataset) {
updateTextInput(session, inputId = "qgb_name", value = dataset)
}
xcmd <- paste0(xcmd, "\n", dataset, " <- result$tab\nregister(\"", dataset, "\")")
}
inp_main <- clean_args(qgb_inputs(), qgb_args)
if (ts$tabsort != "") inp_main <- c(inp_main, tabsort = ts$tabsort)
if (ts$tabfilt != "") inp_main <- c(inp_main, tabfilt = ts$tabfilt)
if (is.empty(inp_main$rows)) {
inp_main$rows <- NULL
}
if (is.empty(input$qgb_tab_slice)) {
inp_main <- c(inp_main, nr = Inf)
} else {
inp_main$tabslice <- input$qgb_tab_slice
}
inp_out <- list(clean_args(qgb_sum_inputs(), qgb_sum_args[-1]))
update_report(
inp_main = inp_main,
fun_name = "qgb",
inp_out = inp_out,
outputs = c(),
figs = FALSE,
xcmd = xcmd
)
}
qib_report <- function() {
## resetting hidden elements to default values
vi <- qib_inputs()
if (input$qib_type != "dist") {
vi$bins <- qib_args$bins
}
if (input$qib_type %in% c("dist", "density")) {
vi$yvar <- qib_args$yvar
}
if (!input$qib_type %in% c("density", "scatter", "dist") ||
!("loess" %in% input$qib_check || "density" %in% input$qib_axes || input$qib_type == "density")) {
vi$smooth <- qib_args$smooth
}
if (!input$qib_type %in% c("scatter", "box") && "jitter" %in% input$qib_check) {
vi$check <- base::setdiff(vi$check, "jitter")
}
if (input$qib_type != "scatter") {
vi$size <- "none"
vi$nrobs <- NULL
} else {
vi$nrobs <- as_integer(vi$nrobs)
}
if (!input$qib_type %in% c("scatter", "line", "box")) {
vi$color <- NULL
}
if (!input$qib_type %in% c("bar", "dist", "density", "surface")) {
vi$fill <- NULL
}
if (!input$qib_type %in% c("bar", "dist", "box", "density")) {
vi$fillcol <- "blue"
}
if (!input$qib_type %in% c("dist", "density", "box", "scatter", "line")) {
vi$linecol <- "black"
}
if (!input$qib_type %in% c("box", "scatter", "line")) {
vi$pointcol <- "black"
}
if (!input$qib_type %in% c("bar", "line", "scatter")) {
vi$fun <- "mean"
}
if (is.empty(input$data_rows)) {
vi$rows <- NULL
}
inp_main <- c(clean_args(vi, qib_args), custom = FALSE)
update_report(
inp_main = inp_main,
fun_name = "qib_chart",
outputs = character(0),
pre_cmd = "",
figs = TRUE,
fig.width = qib_plot_width(),
fig.height = qib_plot_height()
)
}
download_handler(
id = "dl_qgb_tab",
fun = dl_qgb_tab,
fn = function() paste0(input$dataset, "_tab"),
type = "csv"
)
download_handler(
id = "dlp_qib_chart",
fun = download_handler_plot,
fn = function() paste0(input$dataset, "_chart"),
type = "png",
caption = i18n$t("Save visualize plot"),
plot = .qib_chart,
width = qib_plot_width,
height = qib_plot_height
)
observeEvent(input$qgb_report, {
r_info[["latest_screenshot"]] <- NULL
qgb_report()
})
observeEvent(input$qgb_screenshot, {
r_info[["latest_screenshot"]] <- NULL
radiant_screenshot_modal("modal_qgb_screenshot")
})
observeEvent(input$modal_qgb_screenshot, {
qgb_report()
removeModal()
})
observeEvent(input$qib_report, {
r_info[["latest_screenshot"]] <- NULL
qib_report()
})
observeEvent(input$qib_screenshot, {
r_info[["latest_screenshot"]] <- NULL
radiant_screenshot_modal("modal_qib_screenshot")
})
observeEvent(input$modal_qib_screenshot, {
qib_report()
removeModal()
})
# 全选功能
observeEvent(input$qgb_select_all, {
r_funs <- getOption("radiant.functions")
if (!is.null(r_funs)) {
updateCheckboxGroupInput(session, "qgb_fun", selected = r_funs)
}
})
# 全不选功能
observeEvent(input$qgb_deselect_all, {
updateCheckboxGroupInput(session, "qgb_fun", selected = character(0))
})
# 反选功能
observeEvent(input$qgb_invert_selection, {
current <- input$qgb_fun %||% character(0)
r_funs <- getOption("radiant.functions")
if (!is.null(r_funs)) {
new_selection <- setdiff(r_funs, current)
updateCheckboxGroupInput(session, "qgb_fun", selected = new_selection)
}
})
output$quickgen_basic <- renderUI({
stat_tab_panel(
menu = i18n$t("Oneclick generation > Generate descriptive statistics"),
tool = i18n$t("Generate descriptive statistics with one click"),
tool_ui = "ui_quickgen_basic",
output_panels = tagList(
tabPanel(
title = i18n$t("Table"),
download_link("dl_qgb_tab"),br(),
DT::dataTableOutput("qgb_tab"),
tags$hr(),
htmlOutput("qgb_desc_text", inline = FALSE)
),
tabPanel(
title = i18n$t("Chart"),
download_link("dlp_qib_chart"), br(),
plotOutput("qib_chart", width = "100%", height = "auto"),
tags$hr(),
htmlOutput("qib_desc_text", inline = FALSE)
)
)
)
})
## ---------- 表格的描述文字 ----------
output$qgb_desc_text <- renderUI({
dat <- tryCatch(.quickgen(), error = function(e) NULL)
txt <- if (!is.null(dat) && !is.null(dat$tab)) {
make_desc_text(dat$tab)
} else {
" "
}
HTML(markdown::markdownToHTML(text = txt, fragment.only = TRUE))
})
## ---------- 图表的描述文字 ----------
output$qib_desc_text <- renderUI({
df <- tryCatch({
qibi <- qib_inputs()
qibi$envir <- r_data
qibi$dataset <- input$dataset
qibi$shiny <- TRUE
res <- do.call(visualize, qibi)
res$data
}, error = function(e) NULL)
txt <- if (!is.null(df)) make_desc_text(df) else " "
HTML(markdown::markdownToHTML(text = txt, fragment.only = TRUE))
})
\ No newline at end of file
> 一键生成描述性统计
## 函数
以下是 `应用函数`中每个函数的简要说明。
* `样本量(n_obs)`表示所分析变量中非缺失值的总个数,直观告诉你当前统计基于多少条原始记录,是任何后续计算的分母与可信度基础。
* `缺失值数(n_missing)`统计该变量中 NA 的个数,帮助你快速评估数据完整性与潜在偏差,缺失越多越需要审视数据采集或清洗环节。
* `唯一值数(n_distinct)`计数变量中不同取值的个数,可初步判断数据是连续、离散还是近似常数,对后续选择分组或可视化方式起关键提示。
* `均值(mean)`所有非缺失值之和除以个数,反映数据的重心位置,易受极端值拉动,可作为整体水平的“标杆”,但对偏斜分布需结合中位数等补充。
* `中位数(median)`将非缺失值排序后处于中间位置的数,把数据平分为两半,对极端值不敏感,常被用作偏斜分布的“稳健中心”。
* `众数(modal)`出现次数最多的值,类别变量中可直接看出最常出现的类别,连续变量中可揭示潜在峰值或数据录入中的默认值。
* `最小值(min)`所有非缺失值中的最小观测,用于发现异常低值、检测量表下限或评估测量范围。
* `最大值(max)`所有非缺失值中的最大观测,用于发现异常高值、检测量表上限或评估测量范围。
* `总和(sum)`非缺失值的简单累加,常在数量级、总量估计或后续比率计算中直接使用,但须注意量纲与单位。
* `方差(var)`衡量数据围绕均值的离散程度,平方单位放大了离群值的影响,是构建置信区间与假设检验的核心要素。
* `标准差(sd)`方差的平方根,与原始数据同量纲,直观表示“平均离均距离”,在正态假设下可用来构建经验法则区间。
* `标准误(se)`样本均值的标准差,反映用当前样本估计总体均值时可能产生的抽样误差,随样本量增大而减小。
* `误差边际(me)`在指定置信水平下,估计值与真实参数之间可能的最大绝对差距,常用于报告“估计值 ± 误差”形式。
* `变异系数(cv)`标准差与均值的比值,以百分比或无量纲形式衡量相对波动,适用于量纲不同或均值差异大的变量比较。
* `比例(prop)`针对二元或类别变量,计算某一类别占比,直接回答“有多少比例符合某条件”的业务问题。
* `比例方差(varprop)`比例估计量的方差,用于衡量比例的不确定度,是构建比例置信区间的必要中间量。
* `比例标准差(sdprop)`比例方差的平方根,与比例同量纲,方便解释比例估计的波动大小。
* `比例标准误(seprop)`比例估计量的标准误,随样本量增加而减小,用于比例区间估计和假设检验。
* `比例误差边际(meprop)`比例估计在置信水平下的最大误差范围,可直接加到比例上给出上下置信限。
* `总体方差(varpop)`使用总体分母 N 而非样本 n-1 计算的方差,适用于已知总体或加权场景,数值略小于样本方差。
* `总体标准差(sdpop)`总体方差的平方根,用于需要总体参数而非样本推断的场合,例如完整普查数据。
* `1%分位数(p01)`小于该值的数据占1%,可检测极端低值或建立尾部阈值,常用于质量控制或异常检测。
* `2.5%分位数(p025)`小于该值的数据占2.5%,用于构建95%双侧置信区间的下限或识别极端左尾。
* `5%分位数(p05)`小于该值的数据占5%,可作为稳健下限或风险度量中的“最坏5%”阈值。
* `10%分位数(p10)`小于该值的数据占10%,用于稳健范围划定或早期预警线。
* `25%分位数(p25)`第一四分位数,把最低25%的数据与剩余部分分开,常用于箱线图下须计算与离群点判定。
* `75%分位数(p75)`第三四分位数,把最低75%的数据与最高25%分开,与 p25 共同构建 IQR 评估中间50%的离散。
* `90%分位数(p90)`高于该值的数据占10%,在风险管理中表示“极端高值”门槛,也可用于目标设定。
* `95%分位数(p95)`高于该值的数据占5%,常用于工程规格上限或质量控制的警戒值。
* `97.5%分位数(p975)`用于构建95%双侧置信区间的上限或检测极端右尾。
* `99%分位数(p99)`高于该值的数据仅占1%,被视为极端值分界线,适合异常检测或设置高安全阈值。
* `偏度(skew)`刻画数据分布的不对称程度:正值表示右尾更长,负值表示左尾更长,0 左右近似对称,影响均值与中位数差异及后续模型选择。
* `峰度(kurtosi)`描述分布尾部厚度和峰值陡峭程度,高峰度意味着极端值概率更高,低峰度分布更平坦,对风险估计和稳健统计意义重大。
* `四分位距(IQR)`p75 与 p25 的差值,代表中间50%数据的离散范围,不受极端值影响,是箱线图的核心指标之一。
## 图表
### 1.分布图(dist)
**定义与用途**
- 分布图主要用于展示**单个连续变量**的分布情况
- 本质上是一种**直方图**(histogram),通过将数据分成多个区间(bins)并显示每个区间内观测值的数量
- 适用于了解数据的集中趋势、离散程度和分布形状
**特点**
- 可以通过`bins`参数调整分箱数量(默认10个,范围1-50)
- 支持"密度"选项(Density),将纵轴从计数转换为概率密度
- 可以使用"Log X"选项对X轴进行对数变换
- 支持填充颜色(fill)和透明度(alpha)调整
**适用场景**
- 检查变量是否符合正态分布
- 识别数据中的异常值
- 比较不同组别数据的分布差异(通过分面或填充)
**注意事项**
- 仅适用于连续变量
- 分布形状受分箱数量影响,需要适当调整
- 当数据量很大时,可能需要限制显示的数据点数量
### 2.密度图(density)
**定义与用途**
- 密度图是分布图的平滑版本,用于估计**概率密度函数**
- 使用核密度估计(Kernel Density Estimation)方法创建平滑曲线
- 适用于展示单个连续变量的概率分布
**特点**
- 使用`smooth`参数控制平滑度(范围0.1-3.0)
- 比直方图更少受分箱选择的影响
- 可以叠加多个密度曲线进行比较
- 支持"Log X"选项对X轴进行对数变换
**适用场景**
- 比较不同组别数据的分布形状
- 展示数据的概率分布特征
- 当样本量较大时,提供比直方图更平滑的分布表示
**注意事项**
- 过度平滑可能掩盖数据的真实特征
- 适用于连续变量,不适用于分类变量
- 在多模态分布中,可能需要调整平滑参数以显示所有峰值
### 3.散点图(scatter)
**定义与用途**
- 散点图用于展示**两个连续变量**之间的关系
- 每个点代表一个观测值,X和Y坐标分别表示两个变量的值
- 是探索变量间相关性和模式的基本工具
**特点**
- 支持添加回归线("Line"选项)
- 支持添加局部加权回归线("Loess"选项,通过smooth参数控制)
- 支持抖动("Jitter"选项),解决离散变量重叠问题
- 可以使用颜色(color)、填充(fill)和大小(size)编码额外变量
- 可以限制显示的数据点数量(nrobs参数)
**适用场景**
- 探索两个变量之间的相关性
- 识别异常值和数据模式
- 展示三个或更多变量的关系(通过颜色、大小等视觉编码)
**注意事项**
- 当数据量极大时,可能会出现过度重叠,需要限制点数或使用抖动
- 不适合展示分类变量与连续变量的关系(应使用箱线图等)
- 需要谨慎解释相关性与因果关系
### 4.曲面图(surface)
**定义与用途**
- 曲面图用于展示**三个变量**之间的关系
- 两个变量作为X和Y轴,第三个变量作为高度(Z轴)
- 本质上是三维数据的二维表示,通常使用颜色或等高线表示高度
**特点**
- 严格要求恰好两个X变量
- 使用颜色梯度表示Z值的大小
- 适用于连续变量之间的关系
- 可以视为散点图在三维空间的扩展
**适用场景**
- 展示响应曲面(如实验设计中的响应面分析)
- 可视化两个自变量对一个因变量的联合影响
- 展示地理数据中的高程或温度分布
**注意事项**
- 需要恰好两个X变量,否则会报错
- 仅适用于三个连续变量
- 在二维平面上表示三维数据可能造成视觉扭曲
- 数据量较大时可能渲染缓慢
### 5.折线图(line)
**定义与用途**
- 折线图通过连接数据点的线段展示变量随另一个变量(通常是时间)的变化趋势
- 适用于展示连续变化的数据,尤其是时间序列数据
**特点**
- 通常只允许一个X变量
- 支持使用颜色(color)区分多个Y变量
- 可以组合多个Y变量在同一图表中(通过"Combine Y-variables"选项)
- 支持"Log X"和"Log Y"对数坐标轴
**适用场景**
- 展示时间序列数据的趋势和模式
- 比较多个变量随时间的变化
- 显示连续变量之间的函数关系
**注意事项**
- 仅适用于有序数据(特别是时间序列)
- 不适合展示分类变量之间的关系
- 当数据点过多时,线条可能过于复杂难以解读
- 需要确保X轴变量是有序的,否则折线可能产生误导
### 6.条形图(bar)
**定义与用途**
- 条形图使用矩形条的高度表示分类变量的值
- 可以是垂直的(柱状图)或水平的(条形图)
- 适用于比较不同类别之间的数值大小
**特点**
- 通常只允许一个X变量(分类变量)
- 支持使用函数(fun)指定汇总方式(如mean、median)
- 可以使用填充(fill)按子类别分组
- 支持"Flip"选项交换X和Y轴
**适用场景**
- 比较不同类别的计数或汇总统计量
- 展示分类变量的分布
- 比较多个组别在某个指标上的表现
**注意事项**
- X变量应为分类变量(factor)
- 不适合展示连续变量的详细分布
- 当类别过多时,条形可能过于拥挤
- 需要谨慎选择汇总函数(如mean可能受异常值影响)
### 7.箱线图(box)
**定义与用途**
- 箱线图(盒须图)展示数据的五数概括:最小值、第一四分位数(Q1)、中位数、第三四分位数(Q3)和最大值
- 用于比较不同组别数据的分布特征和识别异常值
**特点**
- X变量通常为分类变量,Y变量为连续变量
- 箱体表示中间50%的数据(IQR,四分位距)
- 须线通常延伸到1.5倍IQR范围内的最远点
- 超出须线的点被视为潜在异常值
- 支持抖动("Jitter"选项)显示原始数据点
**适用场景**
- 比较多个组别数据的中心趋势和离散程度
- 识别数据中的异常值
- 检查数据的对称性和偏态
- 比较不同条件下响应变量的分布
**注意事项**
- Y变量应为连续变量,X变量应为分类变量
- 无法显示数据分布的具体形状(如双峰分布)
- 当样本量很小时,箱线图可能不准确
- 需要结合其他图表(如散点图)获取更完整的数据视图
\ No newline at end of file
## ui for quickgen menu in radiant
navbar_proj(
do.call(
navbarPage,
c(
"Radiant for R",
getOption("radiant.nav_ui"),
getOption("radiant.quickgen_ui"),
getOption("radiant.shared_ui"),
help_menu("help_design_ui")
)
)
)
\ No newline at end of file
// radiant.quickgen/run_return.js
# 创建文件 /home/wuzekai/radiant/set_path.R
cat <<'EOF' | sudo tee /home/wuzekai/radiant/set_path.R
options(radiant.launch_dir = "/data")
options(radiant.project_dir = "/data")
EOF
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment