Skip to content

Commit

Permalink
Address unicode lettering (#14)
Browse files Browse the repository at this point in the history
* Switch use of unicode for <= and >= to symbols.

* Re-run documentation

* Remove old distribution variables

* Update the data

* Bump version dependency to R 4.0.0 and fix URL

* Empty space

* Clean up distribution error

* Remove travis and switch over to using GitHub Actions

* Update README

* Add pkgdown website

* Switch the subheader to use greek symbols

* Add release notes

* Bump required version

* Force HTTPS
  • Loading branch information
coatless authored Nov 13, 2023
1 parent 6e24d5f commit 4dfcf4e
Show file tree
Hide file tree
Showing 37 changed files with 245 additions and 134 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
^cran-comments\.md$
^\.travis\.yml$
^CRAN-RELEASE$
^\.github$
^_pkgdown\.yml$
^docs$
^pkgdown$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
49 changes: 49 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
48 changes: 48 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
clean: false
branch: gh-pages
folder: docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
*-Ex.R
.Rproj.user
CRAN-RELEASE
docs
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: visualize
Type: Package
Title: Graph Probability Distributions with User Supplied Parameters and Statistics
Version: 4.4.0
Depends: R (>= 3.0.0)
Version: 4.5.0
Depends: R (>= 4.0.0)
Authors@R: c(
person("James", "Balamuta",
role = c("aut", "cph", "cre"),
Expand All @@ -16,8 +16,8 @@ Description: Graphs the pdf or pmf and highlights what area or probability is
to inequalities. Also provided on the graph is the mean and variance of
the distribution.
License: MIT + file LICENSE
URL: https://github.com/coatless/visualize, http://thecoatlessprofessor.com/projects/visualize/
BugReports: https://github.com/coatless/visualize/issues
URL: https://github.com/coatless-rpkg/visualize, https://thecoatlessprofessor.com/projects/visualize/, https://r-pkg.thecoatlessprofessor.com/visualize/
BugReports: https://github.com/coatless-rpkg/visualize/issues
Encoding: UTF-8
RoxygenNote: 6.1.1
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# visualize 4.5.0 - Hotfix - "Seeing is Greek"

## CHANGES

- Removed unicode to display variables and inequalities per CRAN request.
- Increased the required R version to v4.0.0.
- Switched deployment from Travis to GitHub Actions
- Added a pkgdown website.

# visualize 4.4.0 - Hotfix - "Seeing is Refreshing"

## CHANGES
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
2 changes: 0 additions & 2 deletions R/visualize-distributions.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#' and quantile functions. In addition, mean and variance functions are
#' present. Other descriptors also exist and are documented below.
#'
#'
#' @format
#' Distributions are loaded with the following format:
#' \tabular{ll}{
Expand Down Expand Up @@ -57,7 +56,6 @@
#' @author James Balamuta
#' @keywords datasets internal
#' @examples
#'
#' visualize.distributions = list(
#' 'beta' = list(
#' type = "continuous",
Expand Down
54 changes: 24 additions & 30 deletions R/visualize.continuous.R
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
#' Graphing function for Continuous Distributions.
#'
#' Handles how continuous distributions are graphed. Users should not use this
#' function. Instead, users should use [visualize.it()].
#' function. Instead, users should use [`visualize.it()`].
#'
#'
#' @param dist contains the distribution from
#' [visualize.distributions()].
#' @param stat a statistic to obtain the probability from. When using the
#' "bounded" condition, you must supply the parameter as `stat =
#' c(lower_bound, upper_bound)`. Otherwise, a simple `stat =
#' desired_point` will suffice.
#' @param dist contains a supported continuos distribution shortname.
#' @param stat a statistic to obtain the probability from. When using the
#' "bounded" condition, you must supply the parameter as
#' `stat = c(lower_bound, upper_bound)`. Otherwise, a simple
#' `stat = desired_point` will suffice.
#' @param params A list that must contain the necessary parameters for each
#' distribution. For example, `params = list(mu = 1, sd = 1)` would be for
#' a normal distribution with mean 1 and standard deviation 1. If you are not
#' aware of the parameters for the distribution, consider using the
#' `visualize.`*dist_name* functions listed under the "See Also"
#' section.
#' distribution. For example, `params = list(mu = 1, sd = 1)`
#' would be for a normal distribution with mean 1 and standard
#' deviation 1. If you are not aware of the parameters for the
#' distribution, consider using the `visualize.`*dist_name*
#' functions listed under the "See Also" section.
#' @param section Select how you want the statistic(s) evaluated via
#' `section=` either `"lower"`,`"bounded"`, `"upper"`,
#' or`"tails"`.
#' @author James Balamuta
#' @seealso [visualize.it()], [visualize.beta()],
#' [visualize.chisq()], [visualize.exp()],
#' [visualize.gamma()], [visualize.norm()],
#' [visualize.unif()], [visualize.cauchy()]\*,
#' [visualize.f()]\*, [visualize.lnorm()]\*,
#' [visualize.t()]\*, [visualize.wilcox()]\*,
#' [visualize.logis()]\*. \cr \* = added in v2.0.
#' `section=` either `"lower"`,`"bounded"`, `"upper"`, or`"tails"`
#' @author
#' James Balamuta
#' @seealso
#' [visualize.it()], [visualize.beta()], [visualize.chisq()], [visualize.exp()],
#' [visualize.gamma()], [visualize.norm()], [visualize.unif()], [visualize.cauchy()],
#' [visualize.f()], [visualize.lnorm()], [visualize.t()], [visualize.wilcox()],
#' [visualize.logis()].
#' @export
#' @keywords visualize
#' @examples
#'
#' # Function does not have dist look up, must go through visualize.it
#' visualize.it(dist='norm', stat = c(0,1), params = list(mu = 1, sd = 1), section = "bounded")
#'
Expand Down Expand Up @@ -79,7 +73,7 @@ function(dist, stat = c(0,1), params, section = "lower"){
#Creates the center title by concatenating various bits of information.
#This may need to be optimized at a later time.
graphmain = paste(dist$name," \n")
for(i in 1:length(params)){
for(i in seq_along(params)){
graphmain = paste(graphmain, dist$varsymbols[i]," = ",params[[i]], " ")
}

Expand All @@ -100,7 +94,7 @@ function(dist, stat = c(0,1), params, section = "lower"){
c(0,dist$density(path,params),0),
col="Blue", lty=line_style, lwd=line_width, border="Orange")
prob = dist$probability(stat,params)
subheader = paste("P( ",dist$variable," \u2264 ",stat, ") = ", signif(prob, digits=3))
subheader = paste("P( ",dist$variable," <= ",stat, ") = ", signif(prob, digits=3))
}
else if(section == "bounded"){
start = stat[[1]]; end = stat[[2]];
Expand All @@ -109,7 +103,7 @@ function(dist, stat = c(0,1), params, section = "lower"){
c(0,dist$density(path,params),0),
col="Blue", lty=line_style, lwd=line_width, border="Orange");
prob = dist$probability(end,params) - dist$probability(start,params)
subheader = paste("P(",start," \u2264 ",dist$variable," \u2264 ",end,") =", signif(prob, digits=3))
subheader = paste("P(",start," <= ",dist$variable," <= ",end,") =", signif(prob, digits=3))
}
else if(section == "upper"){
if(ub < stat){
Expand All @@ -120,7 +114,7 @@ function(dist, stat = c(0,1), params, section = "lower"){
c(0,dist$density(path,params),0),
col="Blue", lty=line_style, lwd=line_width, border="Orange")
prob = 1-dist$probability(stat,params)
subheader = paste("P( ",dist$variable," \u2265 ", stat, " ) =", signif(prob, digits=3))
subheader = paste("P( ",dist$variable," >= ", stat, " ) =", signif(prob, digits=3))
}
else if(section == "tails"){
lower_stat = stat[[1]];upper_stat=stat[[2]];
Expand Down Expand Up @@ -166,5 +160,5 @@ function(dist, stat = c(0,1), params, section = "lower"){
axis(1,at=stat[[2]],labels=bquote(eta[.(stat[[2]])]), line=.69)
}
mtext(subheader,3)
title(sub = paste("\u03BC = ", mean,", \u03C3\u00B2 = ", var))
title(sub = bquote(mu ~ "=" ~ .(mean) ~ ", " ~ sigma^2 ~ "=" ~ .(var)))
}
14 changes: 7 additions & 7 deletions R/visualize.discrete.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function(dist, stat = c(0,1), params, section = "lower", strict){

#Creates Graph Title
graphmain = paste(dist$name," \n")
for(i in 1:length(params)){
for(i in seq_along(params)){
graphmain = paste(graphmain, dist$varsymbols[i]," = ",params[[i]], " ")
}

Expand All @@ -70,7 +70,7 @@ function(dist, stat = c(0,1), params, section = "lower", strict){
barplot(y, ylim = c(0, ymax), xlab = "Values", ylab = "Probability", names.arg = x, main=graphmain, col=c(rep("orange",i),rep("white",j)), density=c(rep(3,i),rep(0,j)), add = TRUE)

prob = dist$probability(stat-1*(strict[[1]] == 1),params)
ineqsym = if(strict[[1]]==0){" \u2264 "}else{" < "}
ineqsym = if(strict[[1]]==0){" <= "}else{" < "}
subheader = paste("P( ",dist$variable, ineqsym ,stat, ") = ", signif(prob, digits=3))
}
else if(section == "bounded"){
Expand Down Expand Up @@ -105,8 +105,8 @@ function(dist, stat = c(0,1), params, section = "lower", strict){
#Generate subtitle
prob = dist$probability(disupper-1*(strict[[2]]==1),params) - dist$probability(dislower-1*(strict[[1]]==0),params)
if(prob < 0) {prob = 0}
low_ineq = if(strict[[1]]==0){" \u2264 "}else{" < "}
upper_ineq = if(strict[[2]]==0){" \u2264 "}else{" < "}
low_ineq = if(strict[[1]]==0){" <= "}else{" < "}
upper_ineq = if(strict[[2]]==0){" <= "}else{" < "}
subheader = paste("P(",dislower,low_ineq,dist$variable,upper_ineq,disupper,") =", signif(prob, digits=3))
}
else if(section == "upper"){
Expand Down Expand Up @@ -160,8 +160,8 @@ function(dist, stat = c(0,1), params, section = "lower", strict){

#handle legend information
prob = 1-dist$probability(upper_stat-1*(!upper_strict),params)+dist$probability(lower_stat-1*(lower_strict),params)
upper_ineqsym = if(!upper_strict){" \u2265 "}else{" > "}
lower_ineqsym = if(!lower_strict){" \u2264 "}else{" < "}
upper_ineqsym = if(!upper_strict){" >= "}else{" > "}
lower_ineqsym = if(!lower_strict){" <= "}else{" < "}
subheader = paste("P( ",dist$variable, lower_ineqsym ,lower_stat, " ) + P( ",dist$variable, upper_ineqsym, upper_stat, " ) =", signif(prob, digits=3))
}
else{ stop("Section not specified. Please choose either lower, bounded, tails, or upper.") }
Expand All @@ -175,5 +175,5 @@ function(dist, stat = c(0,1), params, section = "lower", strict){
}

mtext(subheader,3)
title(sub = paste("\u03BC = ", signif(mean, digits=3),", \u03C3\u00B2 = ",signif(var, digits=3)))
title(sub = bquote(mu ~ "=" ~ .(signif(mean, digits=3)) ~ ", " ~ sigma^2 ~ "=" ~ .(signif(var, digits=3))) )
}
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ knitr::opts_chunk$set(
# visualize

<!-- badges: start -->
[![Travis-CI Build Status](https://travis-ci.org/coatless/visualize.svg?branch=master)](https://travis-ci.org/coatless/visualize)
[![R-CMD-check](https://github.com/coatless-rpkg/visualize/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-rpkg/visualize/actions/workflows/R-CMD-check.yaml)
[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/visualize)](http://www.r-pkg.org/pkg/visualize)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/visualize)](https://cran.r-project.org/package=visualize)
<!-- badges: end -->
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

<!-- badges: start -->

[![Travis-CI Build
Status](https://travis-ci.org/coatless/visualize.svg?branch=master)](https://travis-ci.org/coatless/visualize)
[![R-CMD-check](https://github.com/coatless-rpkg/visualize/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/coatless-rpkg/visualize/actions/workflows/R-CMD-check.yaml)
[![CRAN RStudio mirror
downloads](http://cranlogs.r-pkg.org/badges/visualize)](http://www.r-pkg.org/pkg/visualize)[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/visualize)](https://cran.r-project.org/package=visualize)
downloads](http://cranlogs.r-pkg.org/badges/visualize)](http://www.r-pkg.org/pkg/visualize)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/visualize)](https://cran.r-project.org/package=visualize)
<!-- badges: end -->

The goal of visualize is to graph the pdf or pmf and highlight what area
Expand Down
4 changes: 4 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
url: http://r-pkg.thecoatlessprofessor.com/visualize/
template:
bootstrap: 5

Loading

0 comments on commit 4dfcf4e

Please sign in to comment.