Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
huizezhang-sherry committed May 24, 2024
2 parents fa7c546 + 6cad25d commit 40528cd
Show file tree
Hide file tree
Showing 275 changed files with 1,054 additions and 239 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
11 changes: 2 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
Package: tourr
Title: Tour Methods for Multivariate Data Visualisation
Version: 1.0.2
Version: 1.2.0
Authors@R: c(
person("Hadley", "Wickham", email = "h.wickham@gmail.com", role = c("aut", "ctb"), comment = c(ORCID = "0000-0003-4757-117X")),
person("Dianne", "Cook", email = "dicook@monash.edu", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-3813-7155")),
person("Nick", "Spyrison", email = "nicholas.spyrison@monash.edu", role = "ctb", comment = c(ORCID = "0000-0002-8417-0212")),
person("Ursula", "Laa", email = "ursula.laa@boku.ac.at", role = "ctb", comment = c(ORCID = "0000-0002-0249-6439")),
person("H. Sherry","Zhang", email = "huizezhangsh@gmail.com", role = "ctb", comment = c(ORCID = "0000-0002-7122-1463")),
person("Stuart", "Lee", email = "stuart.lee1@monash.edu", role = "ctb", comment = c(ORCID = "0000-0003-1179-8436")))
Author: Hadley Wickham ["aut", "ctb"],
Dianne Cook ["aut", "cre"],
Nick Spyrison ["ctb"],
Ursula Laa ["ctb"],
H. Sherry Zhang ["ctb"],
Stuart Lee ["ctb"]
Maintainer: Dianne Cook <dicook@monash.edu>
Description: Implements geodesic interpolation and basis
generation functions that allow you to create new tour
methods from R.
Expand All @@ -28,7 +21,7 @@ Imports:
utils,
grDevices
Suggests:
TeachingDemos,
aplpack,
ash,
energy,
testthat,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2010-2021
YEAR: 2010-2024
COPYRIGHT HOLDER: Hadley Wickham, Di Cook
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export(animate_stars)
export(animate_stereo)
export(animate_trails)
export(animate_xy)
export(anomaly_index)
export(areColors)
export(basis_init)
export(basis_random)
Expand Down Expand Up @@ -69,6 +70,7 @@ export(frozen_guided_tour)
export(frozen_tour)
export(geodesic_path)
export(grand_tour)
export(guided_anomaly_tour)
export(guided_section_tour)
export(guided_tour)
export(holes)
Expand All @@ -79,6 +81,7 @@ export(linear_breaks)
export(little_tour)
export(local_tour)
export(loess2d)
export(mahal_dist)
export(manual_slice)
export(mapColors)
export(mapShapes)
Expand Down Expand Up @@ -139,7 +142,9 @@ importFrom(graphics,rect)
importFrom(graphics,segments)
importFrom(graphics,stars)
importFrom(graphics,text)
importFrom(stats,mahalanobis)
importFrom(stats,na.omit)
importFrom(stats,qchisq)
importFrom(stats,quantile)
importFrom(stats,residuals)
importFrom(stats,rnorm)
Expand Down
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# tourr 1.2.0

* major change: rescale is now FALSE by default.
* flea is now standardised measurements, and flea_raw is the original units.
* TeachingDemos removed as a Suggests, and replaced with aplpack for drawing Chernoff faces.
* addition of a pre-specified ellipse can be added to the 2D display.
* palette can now be a vector of values.
* a new projection pursuit index for finding anomalies relative to a null variance-covariance matrix. May still need more work.
* point shapes can now be specified like palettes

# tourr 1.1.0

* Updated version to indicate some nice new additions for the package

# tourr 1.0.2

* Fix to duplicating bases during interpolate
Expand Down
15 changes: 15 additions & 0 deletions R/anomaly-pursuit.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#' Anomaly index.
#'
#' Calculates an index that looks for the best projection of
#' observations that are outside a pre-determined p-D ellipse.
#'
#' @export
anomaly_index <- function() {

function(mat, ell2d, ellmu2d) {

mat_tab <- #mean(mahal_dist(mat, ell2d))
mean(mahalanobis(mat, center=ellmu2d, cov=ell2d))
}
}

7 changes: 4 additions & 3 deletions R/data.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#' Flea beatle measurements
#'
#' This data is from a paper by A. A. Lubischew, "On the Use of Discriminant
#' Functions in Taxonomy", Biometrics, Dec 1962, pp.455-477.
#' Functions in Taxonomy", Biometrics, Dec 1962, pp.455-477. Data is
#' standardized, and original units are in flea_raw.
#'
#' \itemize{
#' \item tars1, width of the first joint of the first tarsus in microns
Expand All @@ -16,7 +17,7 @@
#' }
#'
#' @name Flea measurements
#' @aliases flea
#' @aliases flea, flea_raw
#' @docType data
#' @format A 74 x 7 numeric array
#' @keywords datasets
Expand All @@ -25,7 +26,7 @@
#' head(flea)
#' animate_xy(flea[, -7])
#' animate_xy(flea[, -7], col = flea[, 7])
NULL
"flea"

#' Turnable laser measurements from Bellcore
#'
Expand Down
12 changes: 6 additions & 6 deletions R/display-faces.r
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
#' # The drawing code is fairly slow, so this animation works best with a
#' # limited number of cases
#' flea_s <- rescale(flea[,1:6])
#' animate_faces(flea_s[1:2, 1:6])
#' animate_faces(flea_s[1:4, 1:6])
#' animate_faces(flea_s[19:24, 1:6])
#'
#' animate_faces(flea_s[1:2, 1:6], grand_tour(5))
#' animate_faces(flea_s[19:24, 1:6], grand_tour(5))
display_faces <- function(...) {
if (!requireNamespace("TeachingDemos", quietly = TRUE)) {
stop("Please install the TeachingDemos package", call. = FALSE)
if (!requireNamespace("aplpack", quietly = TRUE)) {
stop("Please install the aplpack package", call. = FALSE)
}

render_data <- function(data, proj, geodesic) {
x <- data %*% proj
x <- (x + 2) / 4
TeachingDemos::faces2(x, scale = "none")
aplpack::faces(x, scale = TRUE, face.type = 0,
cex = 0.1, print.info = FALSE)
}

list(
Expand Down
6 changes: 4 additions & 2 deletions R/display-groupxy.r
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#' @param edges.col colour of edges to be plotted, Defaults to "black"
#' @param edges.width line width for edges, default 1
#' @param palette name of color palette for point colour, used by \code{\link{hcl.colors}}, default "Zissou 1"
#' @param shapeset numbers corresponding to shapes in base R points, to use for mapping
#' categorical variable to shapes, default=c(15:17, 23:25)
#' @param ... other arguments passed on to \code{\link{animate}} and
#' \code{\link{display_groupxy}}
#' @export
Expand All @@ -39,7 +41,7 @@ display_groupxy <- function(centr = TRUE, axes = "center", half_range = NULL,
col = "black", pch = 20, cex = 1,
edges = NULL, edges.col = "black", edges.width=1,
group_by = NULL, plot_xgp = TRUE,
palette = "Zissou 1", ...) {
palette = "Zissou 1", shapeset=c(15:17, 23:25), ...) {
labels <- NULL

# If colors are a variable, convert to colors
Expand All @@ -53,7 +55,7 @@ display_groupxy <- function(centr = TRUE, axes = "center", half_range = NULL,
}
# If shapes are a variable, convert shapes
if (is.factor(pch)) {
shapes <- mapShapes(pch)
shapes <- mapShapes(pch, shapeset)
} else {
shapes <- pch
}
Expand Down
Loading

0 comments on commit 40528cd

Please sign in to comment.