├── _pkgdown.yml ├── funding.yml ├── vignettes ├── .gitignore ├── shinydemo.Rmd └── Intro.Rmd ├── example.PNG ├── tests ├── testthat.R └── testthat │ └── test-clickable-links.R ├── docs ├── reference │ ├── Rplot001.png │ ├── ico.html │ ├── index.html │ ├── aquastat_rounder.html │ ├── prettify.html │ ├── finisher.html │ ├── div_maker.html │ ├── tile_matrix.html │ └── multi_box.html ├── pkgdown.yml ├── link.svg ├── sitemap.xml ├── bootstrap-toc.css ├── docsearch.js ├── pkgdown.js ├── articles │ ├── index.html │ └── shinydemo.html ├── bootstrap-toc.js ├── 404.html ├── authors.html ├── news │ └── index.html ├── LICENSE-text.html ├── pkgdown.css ├── CODE_OF_CONDUCT.html └── docsearch.css ├── .Rbuildignore ├── .travis.yml ├── .gitignore ├── man ├── ico.Rd ├── aquastat_rounder.Rd ├── prettify.Rd ├── div_maker.Rd ├── finisher.Rd ├── multi_box.Rd ├── tile_matrix.Rd ├── solo_box_ct.Rd ├── solo_box.Rd └── solo_gradient_box.Rd ├── TileMaker.Rproj ├── NEWS.md ├── NAMESPACE ├── example.html ├── DESCRIPTION ├── LICENSE ├── ..Rcheck └── 00check.log ├── README.Rmd ├── CODE_OF_CONDUCT.md └── README.md /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /funding.yml: -------------------------------------------------------------------------------- 1 | patreon: amitkohli -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /example.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataStrategist/TileMaker/HEAD/example.PNG -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(TileMaker) 3 | 4 | test_check("TileMaker") 5 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataStrategist/TileMaker/HEAD/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: '3.4' 2 | pkgdown: 2.1.3 3 | pkgdown_sha: ~ 4 | articles: 5 | Intro: Intro.html 6 | shinydemo: shinydemo.html 7 | last_built: 2025-08-14T22:38Z 8 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^_pkgdown\.yml$ 2 | ^Meta$ 3 | ^doc$ 4 | ^docs$ 5 | ^.*\.css$ 6 | ^example.html$ 7 | ^.*\.Rproj$ 8 | ^\.Rproj\.user$ 9 | ^\.travis\.yml$ 10 | ^.*\.png$ 11 | ^README.Rmd$ 12 | ^.git$ 13 | CODE_OF_CONDUCT.md 14 | funding.yml 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # R for travis: see documentation at https://docs.travis-ci.com/user/languages/r 2 | 3 | language: r 4 | cache: packages 5 | r_binary_packages: 6 | - dplyr 7 | 8 | r_github_packages: 9 | - jimhester/covr 10 | 11 | after_success: 12 | - Rscript -e 'covr::coveralls()' 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Meta 2 | doc 3 | # History files 4 | .Rhistory 5 | .Rapp.history 6 | 7 | # Session Data files 8 | .RData 9 | # Example code in package build process 10 | *-Ex.R 11 | # RStudio files 12 | .Rproj.user/ 13 | # produced vignettes 14 | vignettes/*.html 15 | vignettes/*.pdf 16 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 17 | .httr-oauth 18 | .Rproj.user 19 | inst/doc 20 | -------------------------------------------------------------------------------- /man/ico.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tile_maker.R 3 | \name{ico} 4 | \alias{ico} 5 | \title{ico} 6 | \usage{ 7 | ico(x, chevron = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{Icon name. See https://getbootstrap.com/docs/3.3/components/} 11 | 12 | \item{chevron}{binary to denote whether there is a former value to compare 13 | against or not.} 14 | } 15 | \description{ 16 | Auxiliary function to generate icons 17 | } 18 | -------------------------------------------------------------------------------- /TileMaker.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace 22 | -------------------------------------------------------------------------------- /man/aquastat_rounder.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tile_maker.R 3 | \name{aquastat_rounder} 4 | \alias{aquastat_rounder} 5 | \title{Perform UN-style rounding} 6 | \usage{ 7 | aquastat_rounder(x) 8 | } 9 | \arguments{ 10 | \item{x}{number to round} 11 | } 12 | \value{ 13 | x, but rounded 14 | } 15 | \description{ 16 | Rounds numbers greater than 1000 to no decimals, 17 | greater than 100 to one decimal, etc. 18 | } 19 | \details{ 20 | DETAILS 21 | } 22 | \examples{ 23 | \dontrun{ 24 | if(interactive()){ 25 | #EXAMPLE1 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # TileMaker 0.2.0 2 | 3 | * Created all new functions using htmlTools. All old functions have been removed (sorry!) 4 | 5 | * Seperated simple box from one that responds to threshold to clarify better hat imputs are required to each 6 | 7 | * file_maker() now doesn't need a filename 8 | 9 | * Added tile_matrix() function to make multiple buttons suitable to quickly take inputs from a dataframe 10 | 11 | * Added multi_box() function to create buttons that contain more than one value and icon. 12 | 13 | * CRAN-ready! 14 | 15 | # TileMaker 0.1.0 16 | 17 | * Converting function to stand-alone package 18 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(div_maker) 4 | export(finisher) 5 | export(ico) 6 | export(multi_box) 7 | export(prettify) 8 | export(solo_box) 9 | export(solo_box_ct) 10 | export(solo_gradient_box) 11 | export(tile_matrix) 12 | importFrom(dplyr,"%>%") 13 | importFrom(dplyr,case_when) 14 | importFrom(dplyr,pull) 15 | importFrom(htmltools,HTML) 16 | importFrom(htmltools,a) 17 | importFrom(htmltools,browsable) 18 | importFrom(htmltools,save_html) 19 | importFrom(htmltools,span) 20 | importFrom(htmltools,tag) 21 | importFrom(htmltools,tags) 22 | importFrom(purrr,pmap) 23 | importFrom(rlang,"!!") 24 | importFrom(rlang,enquo) 25 | importFrom(rlang,syms) 26 | importFrom(tibble,tibble) 27 | -------------------------------------------------------------------------------- /example.html: -------------------------------------------------------------------------------- 1 |
2 |NEWS.md
61 | Created all new functions using htmlTools. All old functions have been removed (sorry!)
Seperated simple box from one that responds to threshold to clarify better hat imputs are required to each
file_maker() now doesn’t need a filename
Added tile_matrix() function to make multiple buttons suitable to quickly take inputs from a dataframe
Added multi_box() function to create buttons that contain more than one value and icon.
CRAN-ready!
The MIT License (MIT) 63 | 64 | Copyright (c) 2017 Amit 65 | 66 | Permission is hereby granted, free of charge, to any person obtaining a copy 67 | of this software and associated documentation files (the "Software"), to deal 68 | in the Software without restriction, including without limitation the rights 69 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 70 | copies of the Software, and to permit persons to whom the Software is 71 | furnished to do so, subject to the following conditions: 72 | 73 | The above copyright notice and this permission notice shall be included in all 74 | copies or substantial portions of the Software. 75 | 76 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 77 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 78 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 79 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 80 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 81 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 82 | SOFTWARE. 83 |84 | 85 |
Auxiliary function to generate icons
66 |ico(x, chevron = FALSE)
63 | All functions64 | 65 | |
66 | |
|---|---|
| 67 | 68 | | 69 |Perform UN-style rounding |
70 |
| 71 | 72 | | 73 |Div maker |
74 |
| 75 | 76 | | 77 |finisher |
78 |
| 79 | 80 | | 81 |ico |
82 |
| 83 | 84 | | 85 |multi_box |
86 |
| 87 | 88 | | 89 |apply pretty format or not |
90 |
| 91 | 92 | | 93 |solo_box |
94 |
| 95 | 96 | | 97 |solo_box_ct |
98 |
| 99 | 100 | | 101 |box that changes colors based on value |
102 |
| 103 | 104 | | 105 |tileMatrix |
106 |
Rounds numbers greater than 1000 to no decimals, 67 | greater than 100 to one decimal, etc.
68 |aquastat_rounder(x)x, but rounded
85 |DETAILS
89 |if (FALSE) { # \dontrun{
94 | if(interactive()){
95 | #EXAMPLE1
96 | }
97 | } # }
98 | to be used inside the functions, just a convenient way to apply 67 | just-in-time formatting
68 |prettify(x, pretty = NULL)returns a character string that looks like x, but beautified
89 |DETAILS
93 |if (FALSE) { # \dontrun{
98 | if(interactive()){
99 | #EXAMPLE1
100 | }
101 | } # }
102 | Function 3 of 3, the last step. This function grabs the Divs created by 70 | `DivMaker`, or individual buttons if so desired, and combines them into a 71 | freestanding html file. Use this when you don't want the buttons to be part 72 | of a file, but a file itself. or, you could also use this as a convenient way 73 | of wrapping up buttons without using a div (although it is a bit irregular).
74 |finisher(
78 | title = NULL,
79 | css = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css",
80 | file = NULL,
81 | textModifier = "h1",
82 | divs
83 | )Title. Default NULL
A string indicating css url, for final installations pls save the 96 | css file locally. By default we are using the 3.3.7 bootstrap CDN because 97 | they support icons, but some others that might be interesting to you are: 98 | https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css or 99 | https://bootswatch.com/4/flatly/bootstrap.css (but if you use version 4 you 100 | will lose the ability to display icons).
Optional filename if you desire to save the file.
Optional css category of "large" text. In this case, 109 | title. Default=h1
div_maker elements.
This function takes buttons made by any of the solo or multi buttons and 68 | makes an a row (HTML `div`) suitable for inclusion in other HTML code, or for 69 | inclusion within the function of this package `finisher`.
70 |div_maker(subtitle, textModifier, ...)div_maker(
98 | subtitle = "Quantativity factors", textModifier = "h1",
99 | solo_gradient_box(value = 70),
100 | solo_box(value = 34)
101 | )
102 | #> -- using target value of 100 --
103 | #> <div class="container">
104 | #> <h1>Quantativity factors</h1>
105 | #> <a>
106 | #> <button class="btn btn-md btn-warning" color="warning" role="button">
107 | #> <h1>70</h1>
108 | #>
109 | #> </button>
110 | #> </a>
111 | #> <a>
112 | #> <button class="btn btn-md btn-info" color="info" role="button">
113 | #> <h1>34</h1>
114 | #>
115 | #> </button>
116 | #> </a>
117 | #> </div>
118 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
67 |Examples of behavior that contributes to creating a positive environment include:
71 |Examples of unacceptable behavior by participants include:
77 |Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
86 |Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
87 |This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
91 |Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at amit@amitkohli.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
95 |Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.
96 |This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
100 |For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
101 |It is also possible to push these Tiles into a Shiny app, using the
94 | htmlOutput and renderUI.
You can either assign objects outside the Shiny call (in the below 96 | example b1 and d1 which includes b1 and b2), or you can embed buttons 97 | inside the Shiny app to display values from there.
98 |(In order to make this work, uncomment the last line in your console. 99 | )
100 |
101 | library(dplyr)
102 | #> Warning: package 'dplyr' was built under R version 4.5.1
103 | #>
104 | #> Attaching package: 'dplyr'
105 | #> The following objects are masked from 'package:stats':
106 | #>
107 | #> filter, lag
108 | #> The following objects are masked from 'package:base':
109 | #>
110 | #> intersect, setdiff, setequal, union
111 | library(htmltools)
112 | #> Warning: package 'htmltools' was built under R version 4.5.1
113 | library(TileMaker)
114 |
115 | b1 <- solo_box(value = 3.57, txt = "Times apple eaten", icon = "apple")
116 | b2 <- solo_box(value = 13.7, txt = "Nutritional value", size = "lg")
117 |
118 | d1 <- div_maker(subtitle = "Quantativity factors", textModifier = "h2", b1, b2)
119 |
120 | # ## Shinydashboard Test --------------
121 | # ## app.R ##
122 | # library(shinydashboard)
123 | # library(shiny)
124 | #
125 | # ui <- dashboardPage(
126 | # dashboardHeader(title = "Basic dashboard"),
127 | # dashboardSidebar(
128 | # sliderInput("slider", "Number of observations:", 1, 100, 50)),
129 | # dashboardBody(
130 | # # Boxes need to be put in a row (or column)
131 | # fluidRow(
132 | # box(
133 | # b1, d1, htmlOutput("plot1")
134 | # )
135 | # )
136 | # )
137 | # )
138 | #
139 | # server <- function(input, output) {
140 | # output$plot1 <- renderUI({
141 | # div_maker(subtitle = "boom", textModifier = "h2", solo_box(value = input$slider, txt = "Times apple eaten", icon = "apple"))
142 | # })
143 | # }
144 |
145 | # shinyApp(ui, server)Create a matrix of buttons suitable for quick comparisons
66 |tile_matrix(
70 | data,
71 | values,
72 | txt,
73 | icon,
74 | former,
75 | target = 100,
76 | thresholdHigh = 90,
77 | thresholdLow = 50,
78 | cols = 4,
79 | title = NULL,
80 | roundVal = 1,
81 | textModifier = "h1"
82 | )a dataframe containing the data you would like to plot
a Vector containing values for each tile, contained in the 95 | dataframe `data`
Vector containing titles for each tile, contained in the datframe 100 | `data`
Optional glyphicon that should be displayed from 105 | https://getbootstrap.com/docs/3.3/components/ you need only supply the name 106 | of thing you want, like "check"... not the full "gyphicon-check"
optional vector containing former values (to show change from 111 | last), contained in the datframe `data`
Optional target that the value should be compared against. Use 116 | with thresholdHigh and THresholdLow
Optional edge between \"green\" and \"orange\" from 121 | 0-100 as a percent of target. IE, this value represents the RATIO of the 122 | VALUE to the target that, if above or equal to the thresholdHigh will show 123 | as green, and if not, as orange. Use w/ target and thresholdLow.
Optional border between \"orange\" and \"red\" from 0-100 128 | as a percent of target. IE, this value represents the RATIO of the VALUE to 129 | the target that, if above or equal to the ThresholdLow will show as orange, 130 | and if not, as red. Use w/ target and thresholdHigh.
Number of columns that the matrix should tile around. Defaults to 135 | 4
The title the matrix should have.
Number of decimals that Value will be rounded to. Defaults to 144 | 1
Optional css category of "large" text. In this case, the 149 | icon, value and unit. Default=h1
Returns a list object containing the matrix of buttons
155 |finisher(title = "Tile Matrix", divs = tile_matrix(
160 | data = head(iris),
161 | values = Sepal.Length,
162 | txt = Species
163 | ))
164 | #> -- using target value of 100 --
165 | #> -- using target value of 100 --
166 | #> -- using target value of 100 --
167 | #> -- using target value of 100 --
168 | #> -- using target value of 100 --
169 | #> -- using target value of 100 --
170 |
171 |
172 | Tile Matrix
173 |
174 |
175 |
176 |
177 |
178 |
182 |
183 |
184 |
188 |
189 |
190 |
194 |
195 |
196 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
210 |
211 |
212 |
216 |
217 |
218 |
219 |
220 |
221 | Create a tile that contains more than one value, icon and text
66 |multi_box(
70 | icons = NULL,
71 | txt = NULL,
72 | values = NULL,
73 | title = NULL,
74 | size = "md",
75 | color = "info",
76 | link = NULL,
77 | number_zoom = 150,
78 | hover = NULL,
79 | ...
80 | )vector of Icons to display, Default: NULL
Optional subtext that should appear under the value
vector of values to display, Default: NULL
Top title, Default: NULL
Optional size specified in the bootstrap css classes: 105 | "xs","sm","md","lg")
Optional bootstrap css element that governs the color. 110 | https://v4-alpha.getbootstrap.com/utilities/colors/ Choose from: "muted", 111 | "primary", "success", "info", "warning", "danger", Default: 'info'
Optional hyperlink to redirect to after a user click, Default: 116 | NULL
Optional magnification % for number vs normal text, 121 | Default: 150
Optional tooltip, or text that will show up when a user rests their 126 | mouse over the tile, Default: NULL
add any other html code here
an HTML object
136 |Allows for each button to contain several icon-number-text descriptions.
140 |library(dplyr)
145 | #> Warning: package 'dplyr' was built under R version 4.5.1
146 | #>
147 | #> Attaching package: 'dplyr'
148 | #> The following objects are masked from 'package:stats':
149 | #>
150 | #> filter, lag
151 | #> The following objects are masked from 'package:base':
152 | #>
153 | #> intersect, setdiff, setequal, union
154 | multi_box(
155 | values = c(21, 45), title = "Important <br>button",
156 | number_zoom = 300, icons = c("apple", "calendar"), color = "warning",
157 | txt = c("times", "reports")
158 | ) %>%
159 | finisher(divs = .)
160 |
161 |
162 |
163 |
164 |
177 |
178 |
179 | if (FALSE) { # \dontrun{
180 | if (interactive()) {
181 | # EXAMPLE1
182 | }
183 | } # }
184 |