diff --git a/R/geom-isoline.r b/R/geom-isoline.r index 7ec1fce..6b3795c 100644 --- a/R/geom-isoline.r +++ b/R/geom-isoline.r @@ -27,14 +27,9 @@ #' - `vjust` #' - `family` #' - `fontface` -#' - `text_colour`, `text_alpha`, `text_size`, `text_angle`, #' - `group` #' -#' The prefixed aesthetics `text_*` are used by the text elements and will -#' inherit any values passed to their un-prefixed counterparts. -#' - #' @import ggplot2 #' @inheritParams ggplot2::layer #' @template param-geom @@ -45,6 +40,9 @@ #' one. #' @param text_dodge Numeric; the orthogonal distance of the text from the axis #' or isoline, as a proportion of the minimum of the plot width and height. +#' @param text.size,text.angle,text.colour,text.color,text.alpha Default +#' aesthetics for tick mark labels. Set to NULL to inherit from the data's +#' aesthetics. #' @template return-layer #' @family geom layers #' @example inst/examples/ex-geom-isoline.r @@ -55,6 +53,8 @@ geom_isoline <- function( by = NULL, num = NULL, text_dodge = .03, ..., + text.size = 3, text.angle = 0, + text.colour = NULL, text.color = NULL, text.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -71,6 +71,10 @@ geom_isoline <- function( isoline_text = isoline_text, by = by, num = num, text_dodge = text_dodge, + text.size = text.size, + text.angle = text.angle, + text.colour = text.color %||% text.colour, + text.alpha = text.alpha, parse = parse, check_overlap = check_overlap, na.rm = na.rm, @@ -93,12 +97,10 @@ GeomIsoline <- ggproto( # isoline colour = "black", alpha = .8, linewidth = .5, linetype = "dashed", - # mark needs - center = 0, scale = 1, - # isoline mark text - text_colour = "black", text_alpha = .8, text_size = 3, text_angle = 0, hjust = "inward", vjust = 1, - family = "", fontface = 1 + family = "", fontface = 1, + # mark needs + center = 0, scale = 1 ), setup_params = function(data, params) { @@ -129,6 +131,8 @@ GeomIsoline <- ggproto( isoline_text = TRUE, by = NULL, num = NULL, text_dodge = .03, + text.size = 3, text.angle = 0, + text.colour = NULL, text.color = NULL, text.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = TRUE ) { @@ -166,6 +170,11 @@ GeomIsoline <- ggproto( if (isoline_text) { text_data <- data + # specify independent aesthetics + text_data$size <- text.size %||% text_data$size + # text_data$angle <- text.angle %||% text_data$angle + text_data$colour <- text.colour %||% text_data$colour + text_data$alpha <- text.alpha %||% text_data$alpha # omit labels at origin text_data <- subset(text_data, x_t != 0 | y_t != 0) @@ -181,14 +190,9 @@ GeomIsoline <- ggproto( # update text angle and put in degrees text_data <- transform( text_data, - angle = (atan(- 1 / tan(angle)) + text_angle) * 180 / pi + angle = (atan(- 1 / tan(angle)) + text.angle) * 180 / pi ) - # specify aesthetics - text_data$colour <- text_data$text_colour - text_data$alpha <- text_data$text_alpha - text_data$size <- text_data$text_size - # isoline text grobs grobs <- c(grobs, list(GeomText$draw_panel( data = text_data, panel_params = panel_params, coord = coord, diff --git a/R/geom-vector.r b/R/geom-vector.r index 19c6d05..f829994 100644 --- a/R/geom-vector.r +++ b/R/geom-vector.r @@ -31,9 +31,12 @@ #' - `linetype` #' - `label` #' - `size` -#' - `angle`, `hjust`, `vjust` -#' - `label_colour`, `label_alpha` -#' - `family`, `fontface`, `lineheight` +#' - `angle` +#' - `hjust` +#' - `vjust` +#' - `family` +#' - `fontface` +#' - `lineheight` #' - `group` #' @@ -47,6 +50,8 @@ #' `NULL` for no arrows. #' @param vector_labels Logical; whether to include labels radiating outward #' from the vectors. +#' @param label.colour,label.color,label.alpha Default aesthetics for labels. +#' Set to NULL to inherit from the data's aesthetics. #' @template return-layer #' @family geom layers #' @example inst/examples/ex-geom-vector.r @@ -56,6 +61,8 @@ geom_vector <- function( arrow = default_arrow, lineend = "round", linejoin = "mitre", vector_labels = TRUE, ..., + label.colour = NULL, label.color = NULL, label.alpha = NULL, + parse = FALSE, check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE ) { @@ -70,6 +77,9 @@ geom_vector <- function( params = list( arrow = arrow, lineend = lineend, linejoin = linejoin, vector_labels = vector_labels, + label.colour = label.color %||% label.colour, + parse = parse, + check_overlap = check_overlap, na.rm = na.rm, ... ) @@ -89,7 +99,6 @@ GeomVector <- ggproto( default_aes = aes( colour = "black", linewidth = 0.5, linetype = 1, alpha = NA, label = "", size = 3.88, angle = 0, hjust = .5, vjust = .5, - label_colour = "black", label_alpha = NA, family = "", fontface = 1, lineheight = 1.2 ), @@ -106,6 +115,7 @@ GeomVector <- ggproto( data, panel_params, coord, vector_labels = TRUE, arrow = default_arrow, lineend = "round", linejoin = "mitre", + label.colour = NULL, label.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = FALSE ) { @@ -128,11 +138,9 @@ GeomVector <- ggproto( if (vector_labels) { label_data <- data - - # specify aesthetics (if necessary) - label_data$colour <- label_data$label_colour - label_data$alpha <- label_data$label_alpha - label_data$label_colour <- label_data$label_alpha <- NULL + # specify independent aesthetics + label_data$colour <- label.colour %||% label_data$colour + label_data$alpha <- label.alpha %||% label_data$alpha if (is.character(label_data$hjust)) { label_data$hjust <- compute_just(label_data$hjust, label_data$x) diff --git a/R/zzz-biplot-geoms.r b/R/zzz-biplot-geoms.r index b9f6ce8..babe681 100644 --- a/R/zzz-biplot-geoms.r +++ b/R/zzz-biplot-geoms.r @@ -1039,6 +1039,11 @@ geom_rows_isoline <- function( num = NULL, text_dodge = 0.03, ..., + text.size = 3, + text.angle = 0, + text.colour = NULL, + text.color = NULL, + text.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = FALSE, @@ -1049,7 +1054,9 @@ geom_rows_isoline <- function( geom = GeomIsoline, position = position, show.legend = show.legend, inherit.aes = inherit.aes, params = list(isoline_text = isoline_text, by = by, num = num, text_dodge = text_dodge, - parse = parse, check_overlap = check_overlap, + text.size = text.size, text.angle = text.angle, + text.colour = text.color %||% text.colour, + text.alpha = text.alpha, parse = parse, check_overlap = check_overlap, na.rm = na.rm, ...)) } @@ -1066,6 +1073,11 @@ geom_cols_isoline <- function( num = NULL, text_dodge = 0.03, ..., + text.size = 3, + text.angle = 0, + text.colour = NULL, + text.color = NULL, + text.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = FALSE, @@ -1076,7 +1088,9 @@ geom_cols_isoline <- function( geom = GeomIsoline, position = position, show.legend = show.legend, inherit.aes = inherit.aes, params = list(isoline_text = isoline_text, by = by, num = num, text_dodge = text_dodge, - parse = parse, check_overlap = check_overlap, + text.size = text.size, text.angle = text.angle, + text.colour = text.color %||% text.colour, + text.alpha = text.alpha, parse = parse, check_overlap = check_overlap, na.rm = na.rm, ...)) } @@ -1265,6 +1279,11 @@ geom_rows_vector <- function( linejoin = "mitre", vector_labels = TRUE, ..., + label.colour = NULL, + label.color = NULL, + label.alpha = NULL, + parse = FALSE, + check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -1273,6 +1292,8 @@ geom_rows_vector <- function( geom = GeomVector, position = position, show.legend = show.legend, inherit.aes = inherit.aes, params = list(arrow = arrow, lineend = lineend, linejoin = linejoin, vector_labels = vector_labels, + label.colour = label.color %||% label.colour, + parse = parse, check_overlap = check_overlap, na.rm = na.rm, ...)) } @@ -1289,6 +1310,11 @@ geom_cols_vector <- function( linejoin = "mitre", vector_labels = TRUE, ..., + label.colour = NULL, + label.color = NULL, + label.alpha = NULL, + parse = FALSE, + check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -1297,6 +1323,8 @@ geom_cols_vector <- function( geom = GeomVector, position = position, show.legend = show.legend, inherit.aes = inherit.aes, params = list(arrow = arrow, lineend = lineend, linejoin = linejoin, vector_labels = vector_labels, + label.colour = label.color %||% label.colour, + parse = parse, check_overlap = check_overlap, na.rm = na.rm, ...)) } diff --git a/docs/articles/cmds-variables.html b/docs/articles/cmds-variables.html index 945f13d..02f9c02 100644 --- a/docs/articles/cmds-variables.html +++ b/docs/articles/cmds-variables.html @@ -135,7 +135,7 @@

dimension reduction of geometric ) lines(x = c(0, 10), y = c(0, 10))

-

In contrast, the variables are better understood through their correlations, which are approximately preserved by their standardized coordinates. Writing X=[y1ym]X = [\,y_1\,\cdots\,y_m\,] as an array of column variables, the covariance between yiy_i and yjy_j is proportional to their inner product $$\textstyle \operatorname{cov}(y_i,y_j) = \frac{1}{n} y_i \cdot y_j = \frac{1}{n} \lVert y_i\rVert\lVert y_j\rVert\cos\theta_{ij}\text,$$ so that the cosine of the angle θij\theta_{ij} between them equals their correlation: cosθij=cov(yi,yj)cov(yi,yi)cov(yj,yj)/n=cov(yi,yj)σiσj=rij\cos\theta_{ij} = \frac{\operatorname{cov}(y_i,y_j)}{\sqrt{\operatorname{cov}(y_i,y_i)\operatorname{cov}(y_j,y_j)}/n} = \frac{\operatorname{cov}(y_i,y_j)}{\sigma_i\sigma_j} = r_{ij}

+

In contrast, the variables are better understood through their correlations, which are approximately preserved by their standardized coordinates. Writing X=[y1ym]X = [\,y_1\,\cdots\,y_m\,] as an array of column variables, the covariance between yiy_i and yjy_j is proportional to their inner product $$\textstyle \operatorname{cov}(y_i,y_j) = \frac{1}{n} y_i \cdot y_j = \frac{1}{n} \lVert y_i\rVert\lVert y_j\rVert\cos\theta_{ij}\text,$$ so that the cosine of the angle θij\theta_{ij} between them equals their correlation: cosθij=cov(yi,yj)cov(yi,yi)cov(yj,yj)/n=cov(yi,yj)σiσj=rij\cos\theta_{ij} = \frac{\operatorname{cov}(y_i,y_j)}{\sqrt{\operatorname{cov}(y_i,y_i)\operatorname{cov}(y_j,y_j)}/n} = \frac{\operatorname{cov}(y_i,y_j)}{\sigma_i\sigma_j} = r_{ij}

Here the cosines between the vectors in the biplot are plotted against the variable correlations rijr_{ij} in the centered and scaled data. While the vectors are shorter in the biplot for the same reason that distances are shorter, their consines may be larger or smaller depending on their respective coordinates in the remaining coordinates.

 # correlations between variables
@@ -159,7 +159,7 @@ 

dimension reduction of geometric

multidimensional scaling of distance data

-

The faithful approximation of inter-case distances by principal coordinates is the idea behind classical multidimensional scaling (CMDS), which can be applied to a data set of distances δij,1ijn\delta_{ij},\ 1\leq i\leq j\leq n in the absence of coordinates (variables). CMDS produces a set of artificial coordinates for the cases that yield nested best approximations of the inter-case distances in terms of the sum of squared errors. The technique uses the eigendecomposition of a doubly-centered matrix of squared distances, which produces a matrix UΛ1/2U \Lambda^{1/2} whose first rr coordinates—for any rnr\leq n—minimize the variance of (UΛ1/2)(UΛ1/2)Δ=UΛUΔ(U \Lambda^{1/2}) (U \Lambda^{1/2})^\top - \Delta = U \Lambda U^\top - \Delta, where Δ=(δij)n×n\Delta = (\delta_{ij}) \in \mathbb{R}^{n\times n}, to obtain the approximation. The columns of UΛ1/2U \Lambda^{1/2} are then called principal coordinates, and the first rr most faithfully recover the δij\delta_{ij} using points in r\mathbb{R}^r of any possible rr. For example, because the road distances between several U.S. cities arise from a roughly 2-dimensional process, the point distances in a CMDS are very close approximations:

+

The faithful approximation of inter-case distances by principal coordinates is the idea behind classical multidimensional scaling (CMDS), which can be applied to a data set of distances δij,1ijn\delta_{ij},\ 1\leq i\leq j\leq n in the absence of coordinates (variables). CMDS produces a set of artificial coordinates for the cases that yield nested best approximations of the inter-case distances in terms of the sum of squared errors. The technique uses the eigendecomposition of a doubly-centered matrix of squared distances, which produces a matrix UΛ1/2U \Lambda^{1/2} whose first rr coordinates—for any rnr\leq n—minimize the variance of (UΛ1/2)(UΛ1/2)Δ=UΛUΔ(U \Lambda^{1/2}) (U \Lambda^{1/2})^\top - \Delta = U \Lambda U^\top - \Delta, where Δ=(δij)n×n\Delta = (\delta_{ij}) \in \mathbb{R}^{n\times n}, to obtain the approximation. The columns of UΛ1/2U \Lambda^{1/2} are then called principal coordinates, and the first rr most faithfully recover the δij\delta_{ij} using points in r\mathbb{R}^r of any possible rr. For example, because the road distances between several U.S. cities arise from a roughly 2-dimensional process, the point distances in a CMDS are very close approximations:

 d <- as.matrix(UScitiesD)
 cent <- diag(1, nrow(d)) - matrix(1/nrow(d), nrow(d), nrow(d))
@@ -177,7 +177,7 @@ 

multidimensional scaling of d ) lines(x = c(0, max(UScitiesD)), y = c(0, max(UScitiesD)))

-

In practice, the goal of CMDS is usually to produce a scatterplot in which the distances (xjxi)2+(yjyi)2\sqrt{(x_j-x_i)^2+(y_j-y_i)^2} between the points that represent the nn cases approximate their original distances δij\delta_{ij}. In this case, the artificial coordinates approximately recover the geographic arrangement. By chance, this CMDS rotated the conventional cardinal directions by about π\pi radians (though at least the map is recognizable from above rather than below the surface of the Earth):

+

In practice, the goal of CMDS is usually to produce a scatterplot in which the distances (xjxi)2+(yjyi)2\sqrt{(x_j-x_i)^2+(y_j-y_i)^2} between the points that represent the nn cases approximate their original distances δij\delta_{ij}. In this case, the artificial coordinates approximately recover the geographic arrangement. By chance, this CMDS rotated the conventional cardinal directions by about π\pi radians (though at least the map is recognizable from above rather than below the surface of the Earth):

 plot(
   d.coord, pch = NA, asp = 1,
@@ -189,7 +189,7 @@ 

multidimensional scaling of d

multidimensional scaling of covariance data

-

The faithful approximation of inter-variable correlations by the angles between their coordinate vectors provides a dual CMDS procedure. Suppose we have data that consist not of distances between cases but of covariances cov(yi,yj),1ijp\operatorname{cov}(y_i,y_j),\ 1\leq i\leq j\leq p between variables. Again the data are coordinate-free, so PCA is inapplicable. But were the data derived from a (not necessarily centered or scaled) case–variable matrix XX, then the covariance matrix C=(cov(yi,yj))C=(\operatorname{cov}(y_i,y_j)) would have been obtained as C=1nXXC=\frac{1}{n}X^\top X. This, up to scalar, is the matrix whose eigenvectors would be given by VV in the SVD X=UDVX = U D V^\top. Therefore, we can obtain artificial coordinates for these variables that approximate what we know of their geometry—thinking of the variables as unknown vectors whose magnitudes and angles are encoded in CC—via an eigendecomposition C=VΛVC = V \Lambda V^\top: Take Y=VΛ1/2p×rY = V \Lambda^{1/2} \in \mathbb{R}^{p\times r}, so that YYCY^\top Y \approx C.

+

The faithful approximation of inter-variable correlations by the angles between their coordinate vectors provides a dual CMDS procedure. Suppose we have data that consist not of distances between cases but of covariances cov(yi,yj),1ijp\operatorname{cov}(y_i,y_j),\ 1\leq i\leq j\leq p between variables. Again the data are coordinate-free, so PCA is inapplicable. But were the data derived from a (not necessarily centered or scaled) case–variable matrix XX, then the covariance matrix C=(cov(yi,yj))C=(\operatorname{cov}(y_i,y_j)) would have been obtained as C=1nXXC=\frac{1}{n}X^\top X. This, up to scalar, is the matrix whose eigenvectors would be given by VV in the SVD X=UDVX = U D V^\top. Therefore, we can obtain artificial coordinates for these variables that approximate what we know of their geometry—thinking of the variables as unknown vectors whose magnitudes and angles are encoded in CC—via an eigendecomposition C=VΛVC = V \Lambda V^\top: Take Y=VΛ1/2p×rY = V \Lambda^{1/2} \in \mathbb{R}^{p\times r}, so that YYCY^\top Y \approx C.

While covariances of the unscaled glass measurements are not meaningful, they can be used to validate the technique. Again because the eigendecomposition is intrinsically ordered by variance, the first rr eigenvectors provide the most faithful rr-dimensional approximation; i’ll take r=2r=2 in anticipation of a biplot:

 # covariances and standard deviations
@@ -230,14 +230,11 @@ 

multidimensional scaling of

use case: rankings of universities

-
## Error in get(paste0(generic, ".", class), envir = get_method_env()) : 
-##   object 'type_sum.accel' not found
- +library(ordr) +library(dplyr)

A natural use case for CMDS of variables is the analysis of multiple rankings of the same set of objects in terms of their concordance. Rankings’ concordance is often measured using rank correlations such as Kendall’s τ\tau, which may be general correlation coefficients in the sense proposed by Kendall but are not associated with an underlying geometry. In this setting, there is no original XX nor Euclidean coordinates. Nevertheless, we can use CMDS to represent these rankings as unit vectors in Euclidean space whose pairwise cosines approximate their rank correlations!

A real-world example is provided by the Quacquarelli Symonds World University Rankings, which include rankings of hundreds of world universities along six dimensions: academic reputation, employer reputation, faculty–student ratio, citations per faculty, international faculty ratio, and international student ratio. QS weight these rankings differently in their overall assessment, but our analysis will compare the rankings to each other across universities, ignoring these weights. The subset qswur_usa installed with ordr include U.S.-based universities ranked in the years 2017–2020, their classifications by QS, and their six integer-valued rankings. (Scores used to generate the rankings are included with the QS data files but omitted from qswur_usa.)

-
+
 data(qswur_usa, package = "ordr")
 print(qswur_usa)
## # A tibble: 612 × 13
@@ -257,7 +254,7 @@ 

use case: rankings of universities## # ℹ 4 more variables: rk_ratio <int>, rk_citations <int>, ## # rk_intl_faculty <int>, rk_intl_students <int>

For this example, i’ll focus only on rankings for the year 2020 for which all rankings were available. This leaves me with only 38 universities, so my conclusions must be taken with caution! Since the rankings were subsetted from the full international data set, they are not contiguous (some integers between rankings never appear). To resolve this, i’ll also recalibrate the rankings by matching each vector of ranks to the vector of its sorted unique values:

-
+
 qswur_usa %>%
   filter(year == 2020L) %>%
   select(institution, starts_with("rk_")) %>%
@@ -298,7 +295,7 @@ 

use case: rankings of universitiescorrelation heatmap

Heatmaps are commonly, perhaps most commonly, used to visualize correlation matrices, and they make a useful contrast to the CMDS correlation plot. Below i use heatmap() to produce a basic correlation heatmap, but the blog post version of this vignette uses the corrplot package to more elegant effect. What can be learned from a glance at this plot? While the rankings by academic and employer reputations are highly concordant, those by international faculty and student ratios are less so. The faculty–student ratio and faculty citation rankings have the weakest concordance of any pair, but they are still positively correlated.

-
+
 corr <- cor(select(qswur_usa2020, starts_with("rk_")), method = "kendall")
 heatmap(corr, scale = "none")

@@ -310,7 +307,7 @@

correlation heatmapcorrelation monoplot

CMDS of variables offers a natural alternative visualization, which Gower, Gardner–Lubbe, and le Roux (2011) call a “correlation monoplot” in that it consists of but one of the two layers of a PCA or other biplot. As with CMDS of cases, the point isn’t to overlay the case scores and variable loadings from a singular value decomposition, but to use the scores or loadings alone to endow the cases or variables with a Euclidean geometry they didn’t originally have. To that end, i’ll plot the variables as vectors with tails at the origin and heads at their principal coordinates Y=VΛ1/2Y = V \Lambda^{1/2}, with a unit circle included for reference:

-
+
 eigen_ord(corr) %>%
   as_tbl_ord() %>%
   augment_ord() %>%
@@ -330,24 +327,24 @@ 

correlation monoplot## Warning: Unknown or uninitialised column: `size`.

With respect to the pairwise correlations, the biplot is significantly less precise: Though the vectors all have unit length in r\mathbb{R}^r (rp=6r\leq p=6), their projections onto the first two principal coordinates are much shorter, indicating that much of the geometric configuration requires additional dimensions to represent. Indeed, these coordinates capture only 48.2%+14.3%=62.5%48.2\%+14.3\%=62.5\% of the inertia in the full, six-dimensional eigendecomposition. This means that the angles between the vectors must be interpreted with caution: For example, it looks like the academic and employer reputation rankings are extremely correlated, but the apparent alignment of the vectors could be an artifact of the projection, when in fact they “rise” and “fall” in opposite directions along the remaining principal coordinates. The correlation heatmap, by comparison, leaves no such ambiguity.

-

However, the biplot far surpasses the heatmap at parsimony: Each variable is represented by a single vector, and the angle cosines between the variable vectors roughly approximate their correlations. For instance, the rankings based on international student and faculty ratios have correlation around cos(π4)=12\cos(\frac{\pi}{4})=\frac{1}{\sqrt{2}}, corresponding to either explaining half the “variance” in the other—not technically meaningful in the ranking context but a useful conceptual anchor. Meanwhile, the faculty–student ratio ranking is nearly independent of the faculty citation ranking, contrary to my intuition that these rankings would reflect a reverse association between research- and teaching-oriented institutions. The convenience of recognizing correlations as cosines may be worth the significant risk of error, especially since that error (the residual 37.5%37.5\% of inertia) can be exactly quantified.

+

However, the biplot far surpasses the heatmap at parsimony: Each variable is represented by a single vector, and the angle cosines between the variable vectors roughly approximate their correlations. For instance, the rankings based on international student and faculty ratios have correlation around cos(π4)=12\cos(\frac{\pi}{4})=\frac{1}{\sqrt{2}}, corresponding to either explaining half the “variance” in the other—not technically meaningful in the ranking context but a useful conceptual anchor. Meanwhile, the faculty–student ratio ranking is nearly independent of the faculty citation ranking, contrary to my intuition that these rankings would reflect a reverse association between research- and teaching-oriented institutions. The convenience of recognizing correlations as cosines may be worth the significant risk of error, especially since that error (the residual 37.5%37.5\% of inertia) can be exactly quantified.

Moreover, the principal coordinates of the variable vectors indicate their loadings onto the first and second principal moments of inertia—the two dimensions that capture the most variation in the data. For example, the first principal coordinate is most aligned with the two reputational rankings, suggesting that a general prestige ranking is the strongest overall component of the several specific rankings. In contrast, the faculty–student ratio and faculty citation rankings load most strongly onto the second principal coordinate, suggesting that the divide between research- and teaching-focused institutions may yet be important to understanding how universities compare along these different metrics. These observations, provisional though they are, would be difficult to discern from the heatmap. More importantly, unlike the secondary patterns visible in the heatmap, these are not artifacts of the layout but arise directly from the (correlational) data.

This last point means that observations made from a correlation monoplot can be validated from the CMDS coordinates. In particular, we can examine the variables’ loadings onto the third principal coordinate, and we can check whether the reputational rankings are aligned or misaligned along it.

-
+
 c_eigen %>%
   fortify(.matrix = "rows") %>%
   select(-name, -.matrix)
## # A tibble: 6 × 8
 ##      EV1     EV2     EV3     EV4     EV5      EV6 metric        .element
 ##    <dbl>   <dbl>   <dbl>   <dbl>   <dbl>    <dbl> <chr>         <chr>   
-## 1 -0.834 -0.0907  0.412  -0.0430 -0.0206  0.351   academic      active  
-## 2 -0.795 -0.0964  0.477   0.0416 -0.181  -0.311   employer      active  
-## 3 -0.517  0.771  -0.0480 -0.331   0.158  -0.0372  ratio         active  
-## 4 -0.731 -0.352  -0.239   0.0278  0.528  -0.0685  citations     active  
-## 5 -0.631 -0.233  -0.521  -0.392  -0.352   0.00783 intl_faculty  active  
-## 6 -0.603  0.262  -0.324   0.665  -0.140   0.0312  intl_students active
+## 1 -0.834 -0.0907 0.412 0.0430 -0.0206 0.351 academic active +## 2 -0.795 -0.0964 0.477 -0.0416 -0.181 -0.311 employer active +## 3 -0.517 0.771 -0.0480 0.331 0.158 -0.0372 ratio active +## 4 -0.731 -0.352 -0.239 -0.0278 0.528 -0.0685 citations active +## 5 -0.631 -0.233 -0.521 0.392 -0.352 0.00783 intl_faculty active +## 6 -0.603 0.262 -0.324 -0.665 -0.140 0.0312 intl_students active

Based on the third principal coordinates, the reputational rankings are aligned, as we knew already from the correlation matrix and heatmap. What’s a bit more interesting is that this component seems to separate these two rankings from those having to do with faculty citation rates and the international compositions of the faculty and student body. Based on the decomposition of inertia, this third principal coordinate is nearly as important as the second! It therefore makes sense to plot the two together, in effect examining the residuals after regressing out the first principal coordinate:

-
+
 c_eigen %>%
   ggbiplot(aes(x = 2, y = 3)) +
   theme_minimal() +
diff --git a/docs/articles/ordr.html b/docs/articles/ordr.html
index f56c8f3..36e3b7e 100644
--- a/docs/articles/ordr.html
+++ b/docs/articles/ordr.html
@@ -102,9 +102,7 @@ 

Ordination in the tidyverse

data(HairEyeColor) library(MASS) library(ordr) -#> Loading required package: ggplot2 -#> Error in get(paste0(generic, ".", class), envir = get_method_env()) : -#> object 'type_sum.accel' not found
+#> Loading required package: ggplot2

the hair and eye color data

@@ -166,9 +164,9 @@

correspondence analysis using
  • The row and column weights r=1nX1r = \frac{1}{n} X 1 and c=1n1Xc = \frac{1}{n} 1^\top X
  • -
  • The diagonals of inverse weights Dr=diag(r)D_r = \operatorname{diag}(r) and Dc=diag(c)D_c = \operatorname{diag}(c) +
  • The diagonals of inverse weights Dr=diag(r)D_r = \operatorname{diag}(r) and Dc=diag(c)D_c = \operatorname{diag}(c)
  • -
  • The matrix of standardized residuals S=Dr(Prc)DcS = D_r (P - rc) D_c +
  • The matrix of standardized residuals S=Dr(Prc)DcS = D_r (P - rc) D_c
  • The singular value decomposition S=UΣVS = U \Sigma V^\top
  • @@ -251,7 +249,7 @@

    #> 3 -0.465 -1.12 1.97 | #> 4 0.354 -2.27 -1.72 |

    The print() method for ‘tbl_ord’ is based on that of tibbles. It prints two tibbles, like that for the ‘tbl_graph’ class of tidygraph, one for each matrix factor.

    -

    The header reminds us of the dimensions of the matrix factors and how the inertia is distributed. In ‘correspondence’ objects, by default both row and column profiles are in standard coordinates: DrFD_r F and DcGD_c G, but these can be reassigned to any pair of proportions DrSDc=(DrUΣp)(DcVΣq)D_r S {D_c}^\top = (D_r U \Sigma^{p}) (D_c V \Sigma^{q})^\top, even if p+q1p + q \neq 1. By assigning "symmetric" inertia, we distribute half of the inertia to each matrix factor:

    +

    The header reminds us of the dimensions of the matrix factors and how the inertia is distributed. In ‘correspondence’ objects, by default both row and column profiles are in standard coordinates: DrFD_r F and DcGD_c G, but these can be reassigned to any pair of proportions DrSDc=(DrUΣp)(DcVΣq)D_r S {D_c}^\top = (D_r U \Sigma^{p}) (D_c V \Sigma^{q})^\top, even if p+q1p + q \neq 1. By assigning "symmetric" inertia, we distribute half of the inertia to each matrix factor:

     get_conference(haireye_ca_ord)
     #> [1] 0 0
    @@ -407,79 +405,78 @@ 

    session infosessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value -#> version R version 4.2.3 (2023-03-15) -#> os macOS Catalina 10.15.7 -#> system x86_64, darwin17.0 +#> version R version 4.3.2 (2023-10-31) +#> os macOS Sonoma 14.4.1 +#> system aarch64, darwin20 #> ui X11 #> language en #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2025-01-22 -#> pandoc 2.16.2 @ /usr/local/bin/ (via rmarkdown) +#> pandoc 2.12 @ /opt/homebrew/anaconda3/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source -#> bslib 0.8.0 2024-07-29 [2] CRAN (R 4.2.3) -#> cachem 1.1.0 2024-05-16 [2] CRAN (R 4.2.3) -#> cli 3.6.3 2024-06-21 [2] CRAN (R 4.2.3) -#> colorspace 2.1-1 2024-07-26 [2] CRAN (R 4.2.3) -#> desc 1.4.3 2023-12-10 [2] CRAN (R 4.2.0) -#> digest 0.6.37 2024-08-19 [2] CRAN (R 4.2.3) -#> dplyr 1.1.4 2023-11-17 [2] CRAN (R 4.2.0) -#> evaluate 1.0.1 2024-10-10 [2] CRAN (R 4.2.3) -#> farver 2.1.2 2024-05-13 [2] CRAN (R 4.2.3) -#> fastmap 1.2.0 2024-05-15 [2] CRAN (R 4.2.3) -#> fs 1.6.4 2024-04-25 [2] CRAN (R 4.2.3) -#> generics 0.1.3 2022-07-05 [2] CRAN (R 4.2.0) -#> ggplot2 * 3.5.1 2024-04-23 [2] CRAN (R 4.2.3) -#> ggrepel 0.9.6 2024-09-07 [2] CRAN (R 4.2.3) -#> glue 1.8.0 2024-09-30 [2] CRAN (R 4.2.3) -#> gtable 0.3.6 2024-10-25 [2] CRAN (R 4.2.3) -#> highr 0.11 2024-05-26 [2] CRAN (R 4.2.3) -#> htmltools 0.5.8.1 2024-04-04 [2] CRAN (R 4.2.3) -#> htmlwidgets 1.6.4 2023-12-06 [2] CRAN (R 4.2.0) -#> jquerylib 0.1.4 2021-04-26 [2] CRAN (R 4.2.0) -#> jsonlite 1.8.9 2024-09-20 [2] CRAN (R 4.2.3) -#> knitr 1.48 2024-07-07 [2] CRAN (R 4.2.3) -#> labeling 0.4.3 2023-08-29 [2] CRAN (R 4.2.0) -#> lifecycle 1.0.4 2023-11-07 [2] CRAN (R 4.2.3) -#> magrittr 2.0.3 2022-03-30 [2] CRAN (R 4.2.0) -#> MASS * 7.3-58.2 2023-01-23 [2] CRAN (R 4.2.3) -#> munsell 0.5.1 2024-04-01 [2] CRAN (R 4.2.3) -#> ordr * 0.1.1.0002 2025-01-22 [1] local -#> pillar 1.10.0 2024-12-17 [2] CRAN (R 4.2.3) -#> pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.2.0) -#> pkgdown 2.1.1 2024-09-17 [2] CRAN (R 4.2.3) -#> purrr 1.0.2 2023-08-10 [2] CRAN (R 4.2.0) -#> R6 2.5.1 2021-08-19 [2] CRAN (R 4.2.0) -#> ragg 1.3.3 2024-09-11 [2] CRAN (R 4.2.3) -#> RColorBrewer 1.1-3 2022-04-03 [2] CRAN (R 4.2.0) -#> Rcpp 1.0.12 2024-01-09 [2] CRAN (R 4.2.3) -#> rlang 1.1.4 2024-06-04 [2] CRAN (R 4.2.3) -#> rmarkdown 2.28 2024-08-17 [2] CRAN (R 4.2.3) -#> sass 0.4.9 2024-03-15 [2] CRAN (R 4.2.3) -#> scales 1.3.0 2023-11-28 [2] CRAN (R 4.2.0) -#> sessioninfo 1.2.2 2021-12-06 [2] CRAN (R 4.2.0) -#> stringi 1.8.4 2024-05-06 [2] CRAN (R 4.2.3) -#> stringr 1.5.1 2023-11-14 [2] CRAN (R 4.2.3) -#> systemfonts 1.1.0 2024-05-15 [2] CRAN (R 4.2.3) -#> textshaping 0.4.0 2024-05-24 [2] CRAN (R 4.2.3) -#> tibble 3.2.1 2023-03-20 [2] CRAN (R 4.2.0) -#> tidyr 1.3.1 2024-01-24 [2] CRAN (R 4.2.3) -#> tidyselect 1.2.1 2024-03-11 [2] CRAN (R 4.2.3) -#> utf8 1.2.4 2023-10-22 [2] CRAN (R 4.2.0) -#> vctrs 0.6.5 2023-12-01 [2] CRAN (R 4.2.0) -#> withr 3.0.2 2024-10-28 [2] CRAN (R 4.2.3) -#> xfun 0.48 2024-10-03 [2] CRAN (R 4.2.3) -#> yaml 2.3.10 2024-07-26 [2] CRAN (R 4.2.3) +#> bslib 0.8.0 2024-07-29 [2] CRAN (R 4.3.3) +#> cachem 1.1.0 2024-05-16 [2] CRAN (R 4.3.3) +#> cli 3.6.3 2024-06-21 [2] CRAN (R 4.3.3) +#> colorspace 2.1-1 2024-07-26 [2] CRAN (R 4.3.3) +#> desc 1.4.3 2023-12-10 [2] CRAN (R 4.3.1) +#> digest 0.6.37 2024-08-19 [2] CRAN (R 4.3.3) +#> dplyr 1.1.4 2023-11-17 [2] CRAN (R 4.3.1) +#> evaluate 1.0.3 2025-01-10 [2] CRAN (R 4.3.3) +#> farver 2.1.2 2024-05-13 [2] CRAN (R 4.3.3) +#> fastmap 1.2.0 2024-05-15 [2] CRAN (R 4.3.3) +#> fs 1.6.5 2024-10-30 [2] CRAN (R 4.3.3) +#> generics 0.1.3 2022-07-05 [2] CRAN (R 4.3.0) +#> ggplot2 * 3.5.1 2024-04-23 [2] CRAN (R 4.3.1) +#> ggrepel 0.9.6 2024-09-07 [2] CRAN (R 4.3.3) +#> glue 1.8.0 2024-09-30 [2] CRAN (R 4.3.3) +#> gtable 0.3.6 2024-10-25 [2] CRAN (R 4.3.3) +#> htmltools 0.5.8.1 2024-04-04 [2] CRAN (R 4.3.1) +#> htmlwidgets 1.6.4 2023-12-06 [2] CRAN (R 4.3.1) +#> jquerylib 0.1.4 2021-04-26 [2] CRAN (R 4.3.0) +#> jsonlite 1.8.9 2024-09-20 [2] CRAN (R 4.3.3) +#> knitr 1.49 2024-11-08 [2] CRAN (R 4.3.3) +#> labeling 0.4.3 2023-08-29 [2] CRAN (R 4.3.0) +#> lifecycle 1.0.4 2023-11-07 [2] CRAN (R 4.3.1) +#> magrittr 2.0.3 2022-03-30 [2] CRAN (R 4.3.0) +#> MASS * 7.3-60 2023-05-04 [2] CRAN (R 4.3.2) +#> munsell 0.5.1 2024-04-01 [2] CRAN (R 4.3.1) +#> ordr * 0.1.1.0002 2025-01-23 [1] local +#> pillar 1.10.1 2025-01-07 [2] CRAN (R 4.3.3) +#> pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.3.0) +#> pkgdown 2.1.1 2024-09-17 [2] CRAN (R 4.3.3) +#> purrr 1.0.2 2023-08-10 [2] CRAN (R 4.3.0) +#> R6 2.5.1 2021-08-19 [2] CRAN (R 4.3.0) +#> ragg 1.3.3 2024-09-11 [2] CRAN (R 4.3.3) +#> RColorBrewer 1.1-3 2022-04-03 [2] CRAN (R 4.3.0) +#> Rcpp 1.0.14 2025-01-12 [2] CRAN (R 4.3.3) +#> rlang 1.1.4 2024-06-04 [2] CRAN (R 4.3.3) +#> rmarkdown 2.29 2024-11-04 [2] CRAN (R 4.3.3) +#> sass 0.4.9 2024-03-15 [2] CRAN (R 4.3.1) +#> scales 1.3.0 2023-11-28 [2] CRAN (R 4.3.1) +#> sessioninfo 1.2.2 2021-12-06 [2] CRAN (R 4.3.0) +#> stringi 1.8.4 2024-05-06 [2] CRAN (R 4.3.1) +#> stringr 1.5.1 2023-11-14 [2] CRAN (R 4.3.1) +#> systemfonts 1.1.0 2024-05-15 [2] CRAN (R 4.3.3) +#> textshaping 0.4.1 2024-12-06 [2] CRAN (R 4.3.3) +#> tibble 3.2.1 2023-03-20 [2] CRAN (R 4.3.0) +#> tidyr 1.3.1 2024-01-24 [2] CRAN (R 4.3.1) +#> tidyselect 1.2.1 2024-03-11 [2] CRAN (R 4.3.1) +#> utf8 1.2.4 2023-10-22 [2] CRAN (R 4.3.1) +#> vctrs 0.6.5 2023-12-01 [2] CRAN (R 4.3.1) +#> withr 3.0.2 2024-10-28 [2] CRAN (R 4.3.3) +#> xfun 0.50 2025-01-07 [2] CRAN (R 4.3.3) +#> yaml 2.3.10 2024-07-26 [2] CRAN (R 4.3.3) #> -#> [1] /private/var/folders/k6/l4mq9ctj3219429xnvqpdbxm8tckkx/T/Rtmpgkj8Hf/temp_libpath290134768767 -#> [2] /Library/Frameworks/R.framework/Versions/4.2/Resources/library +#> [1] /private/var/folders/4p/3cy0qmp15x9216qsqhh84kzm0000gn/T/RtmpaeOcpy/temp_libpath333bbe6528a +#> [2] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library #> #> ──────────────────────────────────────────────────────────────────────────────

    -
    +

    1. Snee RD (1974) “Graphical Display of Two-way Contingency Tables”. The American Statistician 28(1), 9-12. https://doi.org/10.2307/2683520↩︎

    2. diff --git a/docs/articles/ordr_files/figure-html/unnamed-chunk-1-1.png b/docs/articles/ordr_files/figure-html/unnamed-chunk-1-1.png index 98c6f70..be5b65f 100644 Binary files a/docs/articles/ordr_files/figure-html/unnamed-chunk-1-1.png and b/docs/articles/ordr_files/figure-html/unnamed-chunk-1-1.png differ diff --git a/docs/articles/ordr_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/ordr_files/figure-html/unnamed-chunk-4-1.png index 9d09b0d..9f197f9 100644 Binary files a/docs/articles/ordr_files/figure-html/unnamed-chunk-4-1.png and b/docs/articles/ordr_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/authors.html b/docs/authors.html index c460973..01d631e 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -84,13 +84,14 @@

      Citation

      Brunson J, Gracey J (2025). ordr: A Tidyverse Extension for Ordinations and Biplots. -https://github.com/corybrunson/ordr, https://corybrunson.github.io/ordr/. +R package version 0.1.1.0002, https://corybrunson.github.io/ordr/, https://github.com/corybrunson/ordr.

      @Manual{,
         title = {ordr: A Tidyverse Extension for Ordinations and Biplots},
         author = {Jason Cory Brunson and John Gracey},
         year = {2025},
      -  note = {https://github.com/corybrunson/ordr, https://corybrunson.github.io/ordr/},
      +  note = {R package version 0.1.1.0002, https://corybrunson.github.io/ordr/},
      +  url = {https://github.com/corybrunson/ordr},
       }
    diff --git a/docs/index.html b/docs/index.html index b3b06c1..85d4399 100644 --- a/docs/index.html +++ b/docs/index.html @@ -274,7 +274,7 @@

    resources +

    1. Greenacre MJ (2010) Biplots in Practice. Fundacion BBVA, ISBN: 978-84-923846. https://www.fbbva.es/microsite/multivariate-statistics/biplots.html↩︎

    2. diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 07df569..2c286bd 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,7 +1,7 @@ -pandoc: 2.16.2 +pandoc: '2.12' pkgdown: 2.1.1 pkgdown_sha: ~ articles: cmds-variables: cmds-variables.html ordr: ordr.html -last_built: 2025-01-22T22:28Z +last_built: 2025-01-23T01:38Z diff --git a/docs/reference/biplot-geoms.html b/docs/reference/biplot-geoms.html index 095963b..6b3dd68 100644 --- a/docs/reference/biplot-geoms.html +++ b/docs/reference/biplot-geoms.html @@ -662,6 +662,11 @@

      Convenience geoms for row and column matrix factors

      num = NULL, text_dodge = 0.03, ..., + text.size = 3, + text.angle = 0, + text.colour = NULL, + text.color = NULL, + text.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = FALSE, @@ -679,6 +684,11 @@

      Convenience geoms for row and column matrix factors

      num = NULL, text_dodge = 0.03, ..., + text.size = 3, + text.angle = 0, + text.colour = NULL, + text.color = NULL, + text.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = FALSE, @@ -806,6 +816,11 @@

      Convenience geoms for row and column matrix factors

      linejoin = "mitre", vector_labels = TRUE, ..., + label.colour = NULL, + label.color = NULL, + label.alpha = NULL, + parse = FALSE, + check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -821,6 +836,11 @@

      Convenience geoms for row and column matrix factors

      linejoin = "mitre", vector_labels = TRUE, ..., + label.colour = NULL, + label.color = NULL, + label.alpha = NULL, + parse = FALSE, + check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE diff --git a/docs/reference/dplyr-verbs.html b/docs/reference/dplyr-verbs.html index 326a72d..4f2182f 100644 --- a/docs/reference/dplyr-verbs.html +++ b/docs/reference/dplyr-verbs.html @@ -163,9 +163,9 @@

      Examples

      #> # Rows (principal): [ 153 x 2 | 5 ] #> LD1 LD2 | name prior counts .element #> | <chr> <dbl> <int> <chr> -#> 1 7.61 0.215 | 1 setosa 0.333 50 active -#> 2 -1.83 -0.728 | 2 versicolor 0.333 50 active -#> 3 -5.78 0.513 | 3 virginica 0.333 50 active +#> 1 7.61 -0.215 | 1 setosa 0.333 50 active +#> 2 -1.83 0.728 | 2 versicolor 0.333 50 active +#> 3 -5.78 -0.513 | 3 virginica 0.333 50 active #> 4 NA NA | 4 NA NA NA score #> 5 NA NA | 5 NA NA NA score #> # ℹ 148 more rows @@ -174,17 +174,17 @@

      Examples

      #> # Columns (standard): [ 4 x 2 | 2 ] #> LD1 LD2 | name .element #> | <chr> <chr> -#> 1 0.829 0.0241 | 1 Sepal.Length active -#> 2 1.53 2.16 | 2 Sepal.Width active -#> 3 -2.20 -0.932 | 3 Petal.Length active -#> 4 -2.81 2.84 | 4 Petal.Width active +#> 1 0.829 -0.0241 | 1 Sepal.Length active +#> 2 1.53 -2.16 | 2 Sepal.Width active +#> 3 -2.20 0.932 | 3 Petal.Length active +#> 4 -2.81 -2.84 | 4 Petal.Width active # extract a coordinate or annotation head(pull_rows(iris_lda, Species)) #> [1] <NA> <NA> <NA> setosa setosa setosa #> Levels: setosa versicolor virginica pull_cols(iris_lda, LD2) -#> [1] 0.02410215 2.16452123 -0.93192121 2.83918785 +#> [1] -0.02410215 -2.16452123 0.93192121 -2.83918785 # rename an annotation rename_cols(iris_lda, species = name) @@ -194,9 +194,9 @@

      Examples

      #> # Rows (principal): [ 153 x 2 | 5 ] #> LD1 LD2 | name prior counts .element #> | <chr> <dbl> <int> <chr> -#> 1 7.61 0.215 | 1 setosa 0.333 50 active -#> 2 -1.83 -0.728 | 2 versicolor 0.333 50 active -#> 3 -5.78 0.513 | 3 virginica 0.333 50 active +#> 1 7.61 -0.215 | 1 setosa 0.333 50 active +#> 2 -1.83 0.728 | 2 versicolor 0.333 50 active +#> 3 -5.78 -0.513 | 3 virginica 0.333 50 active #> 4 NA NA | 4 NA NA NA score #> 5 NA NA | 5 NA NA NA score #> # ℹ 148 more rows @@ -205,10 +205,10 @@

      Examples

      #> # Columns (standard): [ 4 x 2 | 2 ] #> LD1 LD2 | species .element #> | <chr> <chr> -#> 1 0.829 0.0241 | 1 Sepal.Length active -#> 2 1.53 2.16 | 2 Sepal.Width active -#> 3 -2.20 -0.932 | 3 Petal.Length active -#> 4 -2.81 2.84 | 4 Petal.Width active +#> 1 0.829 -0.0241 | 1 Sepal.Length active +#> 2 1.53 -2.16 | 2 Sepal.Width active +#> 3 -2.20 0.932 | 3 Petal.Length active +#> 4 -2.81 -2.84 | 4 Petal.Width active # select annotations select_rows(iris_lda, species = name, .element) @@ -218,9 +218,9 @@

      Examples

      #> # Rows (principal): [ 153 x 2 | 2 ] #> LD1 LD2 | species .element #> | <chr> <chr> -#> 1 7.61 0.215 | 1 setosa active -#> 2 -1.83 -0.728 | 2 versicolor active -#> 3 -5.78 0.513 | 3 virginica active +#> 1 7.61 -0.215 | 1 setosa active +#> 2 -1.83 0.728 | 2 versicolor active +#> 3 -5.78 -0.513 | 3 virginica active #> 4 NA NA | 4 NA score #> 5 NA NA | 5 NA score #> # ℹ 148 more rows @@ -228,10 +228,10 @@

      Examples

      #> # Columns (standard): [ 4 x 2 | 2 ] #> LD1 LD2 | name .element #> | <chr> <chr> -#> 1 0.829 0.0241 | 1 Sepal.Length active -#> 2 1.53 2.16 | 2 Sepal.Width active -#> 3 -2.20 -0.932 | 3 Petal.Length active -#> 4 -2.81 2.84 | 4 Petal.Width active +#> 1 0.829 -0.0241 | 1 Sepal.Length active +#> 2 1.53 -2.16 | 2 Sepal.Width active +#> 3 -2.20 0.932 | 3 Petal.Length active +#> 4 -2.81 -2.84 | 4 Petal.Width active # create, modify, and delete annotations mutate_cols(iris_lda, vec.length = sqrt(LD1^2 + LD2^2)) @@ -241,9 +241,9 @@

      Examples

      #> # Rows (principal): [ 153 x 2 | 5 ] #> LD1 LD2 | name prior counts .element #> | <chr> <dbl> <int> <chr> -#> 1 7.61 0.215 | 1 setosa 0.333 50 active -#> 2 -1.83 -0.728 | 2 versicolor 0.333 50 active -#> 3 -5.78 0.513 | 3 virginica 0.333 50 active +#> 1 7.61 -0.215 | 1 setosa 0.333 50 active +#> 2 -1.83 0.728 | 2 versicolor 0.333 50 active +#> 3 -5.78 -0.513 | 3 virginica 0.333 50 active #> 4 NA NA | 4 NA NA NA score #> 5 NA NA | 5 NA NA NA score #> # ℹ 148 more rows @@ -252,10 +252,10 @@

      Examples

      #> # Columns (standard): [ 4 x 2 | 3 ] #> LD1 LD2 | name .element vec.length #> | <chr> <chr> <dbl> -#> 1 0.829 0.0241 | 1 Sepal.Length active 0.830 -#> 2 1.53 2.16 | 2 Sepal.Width active 2.65 -#> 3 -2.20 -0.932 | 3 Petal.Length active 2.39 -#> 4 -2.81 2.84 | 4 Petal.Width active 3.99 +#> 1 0.829 -0.0241 | 1 Sepal.Length active 0.830 +#> 2 1.53 -2.16 | 2 Sepal.Width active 2.65 +#> 3 -2.20 0.932 | 3 Petal.Length active 2.39 +#> 4 -2.81 -2.84 | 4 Petal.Width active 3.99 transmute_cols(iris_lda, vec.length = sqrt(LD1^2 + LD2^2)) #> # A tbl_ord of class 'lda_ord': (153 x 2) x (4 x 2)' #> # 2 coordinates: LD1 and LD2 @@ -263,9 +263,9 @@

      Examples

      #> # Rows (principal): [ 153 x 2 | 5 ] #> LD1 LD2 | name prior counts .element #> | <chr> <dbl> <int> <chr> -#> 1 7.61 0.215 | 1 setosa 0.333 50 active -#> 2 -1.83 -0.728 | 2 versicolor 0.333 50 active -#> 3 -5.78 0.513 | 3 virginica 0.333 50 active +#> 1 7.61 -0.215 | 1 setosa 0.333 50 active +#> 2 -1.83 0.728 | 2 versicolor 0.333 50 active +#> 3 -5.78 -0.513 | 3 virginica 0.333 50 active #> 4 NA NA | 4 NA NA NA score #> 5 NA NA | 5 NA NA NA score #> # ℹ 148 more rows @@ -274,10 +274,10 @@

      Examples

      #> # Columns (standard): [ 4 x 2 | 1 ] #> LD1 LD2 | vec.length #> | <dbl> -#> 1 0.829 0.0241 | 1 0.830 -#> 2 1.53 2.16 | 2 2.65 -#> 3 -2.20 -0.932 | 3 2.39 -#> 4 -2.81 2.84 | 4 3.99 +#> 1 0.829 -0.0241 | 1 0.830 +#> 2 1.53 -2.16 | 2 2.65 +#> 3 -2.20 0.932 | 3 2.39 +#> 4 -2.81 -2.84 | 4 3.99 # bind data frames of annotations iris_medians <- @@ -293,9 +293,9 @@

      Examples

      #> # Rows (principal): [ 153 x 2 | 6 ] #> LD1 LD2 | .element Species Sepal.Length #> | <chr> <fct> <dbl> -#> 1 7.61 0.215 | 1 active setosa 5 -#> 2 -1.83 -0.728 | 2 active versicolor 5.9 -#> 3 -5.78 0.513 | 3 active virginica 6.5 +#> 1 7.61 -0.215 | 1 active setosa 5 +#> 2 -1.83 0.728 | 2 active versicolor 5.9 +#> 3 -5.78 -0.513 | 3 active virginica 6.5 #> 4 NA NA | 4 score NA NA #> 5 NA NA | 5 score NA NA #> # ℹ 148 more rows @@ -307,10 +307,10 @@

      Examples

      #> # Columns (standard): [ 4 x 2 | 2 ] #> LD1 LD2 | name .element #> | <chr> <chr> -#> 1 0.829 0.0241 | 1 Sepal.Length active -#> 2 1.53 2.16 | 2 Sepal.Width active -#> 3 -2.20 -0.932 | 3 Petal.Length active -#> 4 -2.81 2.84 | 4 Petal.Width active +#> 1 0.829 -0.0241 | 1 Sepal.Length active +#> 2 1.53 -2.16 | 2 Sepal.Width active +#> 3 -2.20 0.932 | 3 Petal.Length active +#> 4 -2.81 -2.84 | 4 Petal.Width active iris_lda %>% select_rows(name, Species) %>% left_join_rows(iris_medians, by = c("name" = "Species")) @@ -320,9 +320,9 @@

      Examples

      #> # Rows (principal): [ 153 x 2 | 6 ] #> LD1 LD2 | name Species Sepal.Length #> | <chr> <fct> <dbl> -#> 1 7.61 0.215 | 1 setosa NA 5 -#> 2 -1.83 -0.728 | 2 versicolor NA 5.9 -#> 3 -5.78 0.513 | 3 virginica NA 6.5 +#> 1 7.61 -0.215 | 1 setosa NA 5 +#> 2 -1.83 0.728 | 2 versicolor NA 5.9 +#> 3 -5.78 -0.513 | 3 virginica NA 6.5 #> 4 NA NA | 4 NA setosa NA #> 5 NA NA | 5 NA setosa NA #> # ℹ 148 more rows @@ -334,10 +334,10 @@

      Examples

      #> # Columns (standard): [ 4 x 2 | 2 ] #> LD1 LD2 | name .element #> | <chr> <chr> -#> 1 0.829 0.0241 | 1 Sepal.Length active -#> 2 1.53 2.16 | 2 Sepal.Width active -#> 3 -2.20 -0.932 | 3 Petal.Length active -#> 4 -2.81 2.84 | 4 Petal.Width active +#> 1 0.829 -0.0241 | 1 Sepal.Length active +#> 2 1.53 -2.16 | 2 Sepal.Width active +#> 3 -2.20 0.932 | 3 Petal.Length active +#> 4 -2.81 -2.84 | 4 Petal.Width active

    diff --git a/docs/reference/draw-key-1.png b/docs/reference/draw-key-1.png index b99eeb7..b9d47e5 100644 Binary files a/docs/reference/draw-key-1.png and b/docs/reference/draw-key-1.png differ diff --git a/docs/reference/draw-key.html b/docs/reference/draw-key.html index d3e179a..afb2a98 100644 --- a/docs/reference/draw-key.html +++ b/docs/reference/draw-key.html @@ -128,6 +128,9 @@

    Examples

    "Ranges 2 sample standard deviations from centroids" ) #> Warning: Duplicated aesthetics after name standardisation: contour +#> Warning: Computation failed in `stat_rows_center()`. +#> Caused by error in `fun.data.y()`: +#> ! The package "Hmisc" is required.

    diff --git a/docs/reference/geom_bagplot-2.png b/docs/reference/geom_bagplot-2.png index 2424b68..0e86cf0 100644 Binary files a/docs/reference/geom_bagplot-2.png and b/docs/reference/geom_bagplot-2.png differ diff --git a/docs/reference/geom_bagplot-3.png b/docs/reference/geom_bagplot-3.png index 16e1faf..0d10e4f 100644 Binary files a/docs/reference/geom_bagplot-3.png and b/docs/reference/geom_bagplot-3.png differ diff --git a/docs/reference/geom_isoline.html b/docs/reference/geom_isoline.html index 3a4014a..6568617 100644 --- a/docs/reference/geom_isoline.html +++ b/docs/reference/geom_isoline.html @@ -76,6 +76,11 @@

    Isolines (contour lines)

    num = NULL, text_dodge = 0.03, ..., + text.size = 3, + text.angle = 0, + text.colour = NULL, + text.color = NULL, + text.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = FALSE, @@ -154,6 +159,12 @@

    Arguments

    Additional arguments passed to ggplot2::layer().

    +
    text.size, text.angle, text.colour, text.color, text.alpha
    +

    Default +aesthetics for tick mark labels. Set to NULL to inherit from the data's +aesthetics.

    + +
    parse

    If TRUE, the labels will be parsed into expressions and displayed as described in ?plotmath.

    @@ -225,11 +236,8 @@

    Aesthetics

  • vjust

  • family

  • fontface

  • -
  • text_colour, text_alpha, text_size, text_angle,

  • group

  • -

    The prefixed aesthetics text_* are used by the text elements and will -inherit any values passed to their un-prefixed counterparts.

    -
    +

    References

    Greenacre MJ (2010) Biplots in Practice. Fundacion BBVA, ISBN: diff --git a/docs/reference/geom_lineranges-1.png b/docs/reference/geom_lineranges-1.png index b169253..09eaa17 100644 Binary files a/docs/reference/geom_lineranges-1.png and b/docs/reference/geom_lineranges-1.png differ diff --git a/docs/reference/geom_lineranges.html b/docs/reference/geom_lineranges.html index f14c3e6..41eb479 100644 --- a/docs/reference/geom_lineranges.html +++ b/docs/reference/geom_lineranges.html @@ -261,6 +261,9 @@

    Examples

    "Row-principal LRA biplot of Freestone glass measurements", "Ranges 2 sample standard deviations from centroids" ) +#> Warning: Computation failed in `stat_rows_center()`. +#> Caused by error in `fun.data.y()`: +#> ! The package "Hmisc" is required.
    diff --git a/docs/reference/geom_vector.html b/docs/reference/geom_vector.html index 7e325e1..d475ca1 100644 --- a/docs/reference/geom_vector.html +++ b/docs/reference/geom_vector.html @@ -78,6 +78,11 @@

    Vectors from the origin

    linejoin = "mitre", vector_labels = TRUE, ..., + label.colour = NULL, + label.color = NULL, + label.alpha = NULL, + parse = FALSE, + check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -157,6 +162,11 @@

    Arguments

    Additional arguments passed to ggplot2::layer().

    +
    label.colour, label.color, label.alpha
    +

    Default aesthetics for labels. +Set to NULL to inherit from the data's aesthetics.

    + +
    na.rm

    Passed to ggplot2::layer().

    @@ -215,9 +225,12 @@

    Aesthetics

  • linetype

  • label

  • size

  • -
  • angle, hjust, vjust

  • -
  • label_colour, label_alpha

  • -
  • family, fontface, lineheight

  • +
  • angle

  • +
  • hjust

  • +
  • vjust

  • +
  • family

  • +
  • fontface

  • +
  • lineheight

  • group

  • diff --git a/docs/reference/ggbiplot-1.png b/docs/reference/ggbiplot-1.png index d25a472..ef76c99 100644 Binary files a/docs/reference/ggbiplot-1.png and b/docs/reference/ggbiplot-1.png differ diff --git a/docs/reference/ggbiplot-2.png b/docs/reference/ggbiplot-2.png index cdb24c7..4c9f881 100644 Binary files a/docs/reference/ggbiplot-2.png and b/docs/reference/ggbiplot-2.png differ diff --git a/docs/reference/ggbiplot-5.png b/docs/reference/ggbiplot-5.png index 96e0493..c198189 100644 Binary files a/docs/reference/ggbiplot-5.png and b/docs/reference/ggbiplot-5.png differ diff --git a/docs/reference/ggbiplot-6.png b/docs/reference/ggbiplot-6.png index f0b3012..8832b8e 100644 Binary files a/docs/reference/ggbiplot-6.png and b/docs/reference/ggbiplot-6.png differ diff --git a/docs/reference/lda-ord-1.png b/docs/reference/lda-ord-1.png index a871af1..02b0203 100644 Binary files a/docs/reference/lda-ord-1.png and b/docs/reference/lda-ord-1.png differ diff --git a/docs/reference/lda-ord-2.png b/docs/reference/lda-ord-2.png index 4c9dc5a..10dfcf7 100644 Binary files a/docs/reference/lda-ord-2.png and b/docs/reference/lda-ord-2.png differ diff --git a/docs/reference/lda-ord-3.png b/docs/reference/lda-ord-3.png index 9f8d554..1e2b4eb 100644 Binary files a/docs/reference/lda-ord-3.png and b/docs/reference/lda-ord-3.png differ diff --git a/docs/reference/lda-ord-4.png b/docs/reference/lda-ord-4.png index 16be042..cc74629 100644 Binary files a/docs/reference/lda-ord-4.png and b/docs/reference/lda-ord-4.png differ diff --git a/docs/reference/lda-ord.html b/docs/reference/lda-ord.html index 694a2fa..7b2a2a5 100644 --- a/docs/reference/lda-ord.html +++ b/docs/reference/lda-ord.html @@ -279,15 +279,15 @@

    Examples

    # linear combinations of centered variables print(sweep(iris_lda$means, 2, iris_centroid, "-") %*% get_cols(iris_lda)) #> LD1 LD2 -#> setosa 7.607600 0.2151330 -#> versicolor -1.825049 -0.7278996 -#> virginica -5.782550 0.5127666 +#> setosa 7.607600 -0.2151330 +#> versicolor -1.825049 0.7278996 +#> virginica -5.782550 -0.5127666 # discriminant centroids print(get_rows(iris_lda, elements = "active")) #> LD1 LD2 -#> setosa 7.607600 0.2151330 -#> versicolor -1.825049 -0.7278996 -#> virginica -5.782550 0.5127666 +#> setosa 7.607600 -0.2151330 +#> versicolor -1.825049 0.7278996 +#> virginica -5.782550 -0.5127666 # unstandardized coefficient LDA biplot iris_lda %>% diff --git a/docs/reference/lra-ord-1.png b/docs/reference/lra-ord-1.png index 4f840f8..d04f4f5 100644 Binary files a/docs/reference/lra-ord-1.png and b/docs/reference/lra-ord-1.png differ diff --git a/docs/reference/lra-ord-2.png b/docs/reference/lra-ord-2.png index e156d5e..93ef4de 100644 Binary files a/docs/reference/lra-ord-2.png and b/docs/reference/lra-ord-2.png differ diff --git a/docs/reference/lra-ord-3.png b/docs/reference/lra-ord-3.png index 9123fb0..04c7be5 100644 Binary files a/docs/reference/lra-ord-3.png and b/docs/reference/lra-ord-3.png differ diff --git a/docs/reference/methods-cancor-1.png b/docs/reference/methods-cancor-1.png index ecec953..a9c9d82 100644 Binary files a/docs/reference/methods-cancor-1.png and b/docs/reference/methods-cancor-1.png differ diff --git a/docs/reference/methods-factanal-1.png b/docs/reference/methods-factanal-1.png index ebef115..c3fd008 100644 Binary files a/docs/reference/methods-factanal-1.png and b/docs/reference/methods-factanal-1.png differ diff --git a/docs/reference/methods-kmeans-2.png b/docs/reference/methods-kmeans-2.png index a2020f6..9a1dcb2 100644 Binary files a/docs/reference/methods-kmeans-2.png and b/docs/reference/methods-kmeans-2.png differ diff --git a/docs/reference/methods-kmeans.html b/docs/reference/methods-kmeans.html index c2d5578..f55b639 100644 --- a/docs/reference/methods-kmeans.html +++ b/docs/reference/methods-kmeans.html @@ -248,15 +248,14 @@

    Examples

    ggbiplot(aes(x = `2`, y = `3`), color = factor(.cluster)) + geom_jitter(stat = "rows", aes(shape = cluster), width = .2, height = .2) + geom_cols_axis(aes(color = `1`, label = name), - text_size = 2, text_dodge = .1, - label_size = 3, label_alpha = .5) + + text.size = 2, text_dodge = .1, + size = 3, label.alpha = .5) + scale_x_continuous(expand = expansion(mult = .8)) + scale_y_continuous(expand = expansion(mult = .5)) + ggtitle( "Measurement loadings onto clusters 2 and 3", "Color indicates loadings onto cluster 1" ) -#> Warning: Ignoring unknown parameters: `text_size`, `label_size`, and `label_alpha`
    diff --git a/docs/reference/methods-lda.html b/docs/reference/methods-lda.html index e52a3de..00fba25 100644 --- a/docs/reference/methods-lda.html +++ b/docs/reference/methods-lda.html @@ -191,41 +191,41 @@

    Examples

    #> # Rows (principal): [ 153 x 2 | 0 ] #> LD1 LD2 | #> | -#> 1 7.61 0.215 | -#> 2 -1.83 -0.728 | -#> 3 -5.78 0.513 | -#> 4 8.06 0.300 | -#> 5 7.13 -0.787 | +#> 1 7.61 -0.215 | +#> 2 -1.83 0.728 | +#> 3 -5.78 -0.513 | +#> 4 8.06 -0.300 | +#> 5 7.13 0.787 | #> #> # #> # Columns (standard): [ 4 x 2 | 0 ] #> LD1 LD2 | #> | -#> 1 0.829 0.0241 | -#> 2 1.53 2.16 | -#> 3 -2.20 -0.932 | -#> 4 -2.81 2.84 | +#> 1 0.829 -0.0241 | +#> 2 1.53 -2.16 | +#> 3 -2.20 0.932 | +#> 4 -2.81 -2.84 | # recover centroid coordinates and measurement discriminant coefficients get_rows(iris_lda, elements = "active") #> LD1 LD2 -#> setosa 7.607600 0.2151330 -#> versicolor -1.825049 -0.7278996 -#> virginica -5.782550 0.5127666 +#> setosa 7.607600 -0.2151330 +#> versicolor -1.825049 0.7278996 +#> virginica -5.782550 -0.5127666 head(get_rows(iris_lda, elements = "score")) #> LD1 LD2 -#> [1,] 8.061800 0.3004206 -#> [2,] 7.128688 -0.7866604 -#> [3,] 7.489828 -0.2653845 -#> [4,] 6.813201 -0.6706311 -#> [5,] 8.132309 0.5144625 -#> [6,] 7.701947 1.4617210 +#> [1,] 8.061800 -0.3004206 +#> [2,] 7.128688 0.7866604 +#> [3,] 7.489828 0.2653845 +#> [4,] 6.813201 0.6706311 +#> [5,] 8.132309 -0.5144625 +#> [6,] 7.701947 -1.4617210 get_cols(iris_lda) #> LD1 LD2 -#> Sepal.Length 0.8293776 0.02410215 -#> Sepal.Width 1.5344731 2.16452123 -#> Petal.Length -2.2012117 -0.93192121 -#> Petal.Width -2.8104603 2.83918785 +#> Sepal.Length 0.8293776 -0.02410215 +#> Sepal.Width 1.5344731 -2.16452123 +#> Petal.Length -2.2012117 0.93192121 +#> Petal.Width -2.8104603 -2.83918785 # augment ordination with centroid and measurement names augment_ord(iris_lda) @@ -235,21 +235,21 @@

    Examples

    #> # Rows (principal): [ 153 x 2 | 5 ] #> LD1 LD2 | name prior counts grouping #> | <chr> <dbl> <int> <chr> -#> 1 7.61 0.215 | 1 setosa 0.333 50 setosa -#> 2 -1.83 -0.728 | 2 versicolor 0.333 50 versicol… -#> 3 -5.78 0.513 | 3 virginica 0.333 50 virginica -#> 4 8.06 0.300 | 4 NA NA NA setosa -#> 5 7.13 -0.787 | 5 NA NA NA setosa +#> 1 7.61 -0.215 | 1 setosa 0.333 50 setosa +#> 2 -1.83 0.728 | 2 versicolor 0.333 50 versicol… +#> 3 -5.78 -0.513 | 3 virginica 0.333 50 virginica +#> 4 8.06 -0.300 | 4 NA NA NA setosa +#> 5 7.13 0.787 | 5 NA NA NA setosa #> # ℹ 148 more rows #> # ℹ 1 more variable: .element <chr> #> # #> # Columns (standard): [ 4 x 2 | 2 ] #> LD1 LD2 | name .element #> | <chr> <chr> -#> 1 0.829 0.0241 | 1 Sepal.Length active -#> 2 1.53 2.16 | 2 Sepal.Width active -#> 3 -2.20 -0.932 | 3 Petal.Length active -#> 4 -2.81 2.84 | 4 Petal.Width active +#> 1 0.829 -0.0241 | 1 Sepal.Length active +#> 2 1.53 -2.16 | 2 Sepal.Width active +#> 3 -2.20 0.932 | 3 Petal.Length active +#> 4 -2.81 -2.84 | 4 Petal.Width active diff --git a/docs/reference/methods-lm.html b/docs/reference/methods-lm.html index b6a1058..37807c8 100644 --- a/docs/reference/methods-lm.html +++ b/docs/reference/methods-lm.html @@ -167,7 +167,7 @@

    Examples

    #> #> Coefficients: #> (Intercept) wt cyl -#> 6.721e-16 -3.191e+00 -1.508e+00 +#> 5.574e-15 -3.191e+00 -1.508e+00 #> # wrap as a 'tbl_ord' object @@ -188,7 +188,7 @@

    Examples

    #> # Columns: [ 1 x 3 | 0 ] #> `(Intercept)` wt cyl | #> | -#> 1 6.72e-16 -3.19 -1.51 | +#> 1 5.57e-15 -3.19 -1.51 | # augment everything with names, predictors with observation stats augment_ord(mtcars_lm_ord) #> # A tbl_ord of class 'lm': (32 x 3) x (1 x 3)' @@ -209,7 +209,7 @@

    Examples

    #> # Columns: [ 1 x 3 | 1 ] #> `(Intercept)` wt cyl | name #> | <chr> -#> 1 6.72e-16 -3.19 -1.51 | 1 mpg +#> 1 5.57e-15 -3.19 -1.51 | 1 mpg # calculate influences as the squares of weighted residuals mutate_rows(augment_ord(mtcars_lm_ord), influence = wt.res^2) #> # A tbl_ord of class 'lm': (32 x 3) x (1 x 3)' @@ -230,7 +230,7 @@

    Examples

    #> # Columns: [ 1 x 3 | 1 ] #> `(Intercept)` wt cyl | name #> | <chr> -#> 1 6.72e-16 -3.19 -1.51 | 1 mpg +#> 1 5.57e-15 -3.19 -1.51 | 1 mpg # regression biplot with performance isolines mtcars_lm_ord %>% @@ -265,7 +265,7 @@

    Examples

    #> # Columns: [ 1 x 3 | 2 ] #> `(Intercept)` wt cyl | name center #> | <chr> <dbl> -#> 1 6.72e-16 -3.19 -1.51 | 1 mpg 20.1 +#> 1 5.57e-15 -3.19 -1.51 | 1 mpg 20.1 diff --git a/docs/reference/methods-lra-1.png b/docs/reference/methods-lra-1.png index 70e3b4b..007abb0 100644 Binary files a/docs/reference/methods-lra-1.png and b/docs/reference/methods-lra-1.png differ diff --git a/docs/reference/methods-mca-1.png b/docs/reference/methods-mca-1.png index a79819f..b5a2de2 100644 Binary files a/docs/reference/methods-mca-1.png and b/docs/reference/methods-mca-1.png differ diff --git a/docs/reference/methods-mca.html b/docs/reference/methods-mca.html index 98e9c77..6f30e08 100644 --- a/docs/reference/methods-mca.html +++ b/docs/reference/methods-mca.html @@ -167,58 +167,58 @@

    Examples

    #> # 2 coordinates: Dim1 and Dim2 #> # #> # Rows (principal): [ 9052 x 2 | 2 ] -#> Dim1 Dim2 | name .element -#> | <chr> <chr> -#> 1 -0.0100 0.00261 | 1 1 active -#> 2 -0.0100 0.00261 | 2 1.1 active -#> 3 -0.0100 0.00261 | 3 1.2 active -#> 4 -0.0100 0.00261 | 4 1.3 active -#> 5 -0.0100 0.00261 | 5 1.4 active +#> Dim1 Dim2 | name .element +#> | <chr> <chr> +#> 1 -0.0100 -0.00261 | 1 1 active +#> 2 -0.0100 -0.00261 | 2 1.1 active +#> 3 -0.0100 -0.00261 | 3 1.2 active +#> 4 -0.0100 -0.00261 | 4 1.3 active +#> 5 -0.0100 -0.00261 | 5 1.4 active #> # ℹ 9,047 more rows #> # #> # Columns (standard): [ 10 x 2 | 4 ] #> Dim1 Dim2 | name factor level .element #> | <chr> <chr> <chr> <chr> -#> 1 -0.00533 0.00483 | 1 Admit.Admi… Admit Admi… active -#> 2 0.00338 -0.00306 | 2 Admit.Reje… Admit Reje… active -#> 3 -0.00397 -0.00266 | 3 Gender.Male Gender Male active -#> 4 0.00582 0.00390 | 4 Gender.Fem… Gender Fema… active -#> 5 -0.00748 0.000829 | 5 Dept.A Dept A active -#> 6 -0.00838 -0.00295 | 6 Dept.B Dept B active -#> 7 0.00395 0.00851 | 7 Dept.C Dept C active -#> 8 0.00160 0.000439 | 8 Dept.D Dept D active -#> 9 0.00561 0.00450 | 9 Dept.E Dept E active -#> 10 0.00519 -0.0138 | 10 Dept.F Dept F active +#> 1 -0.00533 -0.00483 | 1 Admit.Admi… Admit Admi… active +#> 2 0.00338 0.00306 | 2 Admit.Reje… Admit Reje… active +#> 3 -0.00397 0.00266 | 3 Gender.Male Gender Male active +#> 4 0.00582 -0.00390 | 4 Gender.Fem… Gender Fema… active +#> 5 -0.00748 -0.000829 | 5 Dept.A Dept A active +#> 6 -0.00838 0.00295 | 6 Dept.B Dept B active +#> 7 0.00395 -0.00851 | 7 Dept.C Dept C active +#> 8 0.00160 -0.000439 | 8 Dept.D Dept D active +#> 9 0.00561 -0.00450 | 9 Dept.E Dept E active +#> 10 0.00519 0.0138 | 10 Dept.F Dept F active # recover row and column coordinates and row weights head(get_rows(admissions_mca, elements = "score")) -#> Dim1 Dim2 -#> 1 -0.005592325 0.001001186 -#> 1.1 -0.005592325 0.001001186 -#> 1.2 -0.005592325 0.001001186 -#> 1.3 -0.005592325 0.001001186 -#> 1.4 -0.005592325 0.001001186 -#> 1.5 -0.005592325 0.001001186 +#> Dim1 Dim2 +#> 1 -0.005592325 -0.001001186 +#> 1.1 -0.005592325 -0.001001186 +#> 1.2 -0.005592325 -0.001001186 +#> 1.3 -0.005592325 -0.001001186 +#> 1.4 -0.005592325 -0.001001186 +#> 1.5 -0.005592325 -0.001001186 get_cols(admissions_mca) #> Dim1 Dim2 -#> Admit.Admitted -0.005329295 0.0048307823 -#> Admit.Rejected 0.003375284 -0.0030595536 -#> Gender.Male -0.003971450 -0.0026563610 -#> Gender.Female 0.005824072 0.0038955136 -#> Dept.A -0.007476230 0.0008291371 -#> Dept.B -0.008381159 -0.0029516575 -#> Dept.C 0.003949742 0.0085082718 -#> Dept.D 0.001600698 0.0004388113 -#> Dept.E 0.005610973 0.0045007472 -#> Dept.F 0.005193103 -0.0137723160 +#> Admit.Admitted -0.005329295 -0.0048307823 +#> Admit.Rejected 0.003375284 0.0030595536 +#> Gender.Male -0.003971450 0.0026563610 +#> Gender.Female 0.005824072 -0.0038955136 +#> Dept.A -0.007476230 -0.0008291371 +#> Dept.B -0.008381159 0.0029516575 +#> Dept.C 0.003949742 -0.0085082718 +#> Dept.D 0.001600698 -0.0004388113 +#> Dept.E 0.005610973 -0.0045007472 +#> Dept.F 0.005193103 0.0137723160 head(get_rows(admissions_mca)) -#> Dim1 Dim2 -#> 1 -0.009997779 0.002609712 -#> 1.1 -0.009997779 0.002609712 -#> 1.2 -0.009997779 0.002609712 -#> 1.3 -0.009997779 0.002609712 -#> 1.4 -0.009997779 0.002609712 -#> 1.5 -0.009997779 0.002609712 +#> Dim1 Dim2 +#> 1 -0.009997779 -0.002609712 +#> 1.1 -0.009997779 -0.002609712 +#> 1.2 -0.009997779 -0.002609712 +#> 1.3 -0.009997779 -0.002609712 +#> 1.4 -0.009997779 -0.002609712 +#> 1.5 -0.009997779 -0.002609712 # column-standard biplot of factor levels admissions_mca %>% diff --git a/docs/reference/negation-3.png b/docs/reference/negation-3.png index cfbcc3e..e86b3bd 100644 Binary files a/docs/reference/negation-3.png and b/docs/reference/negation-3.png differ diff --git a/docs/reference/negation-4.png b/docs/reference/negation-4.png index 52b44c8..526cda6 100644 Binary files a/docs/reference/negation-4.png and b/docs/reference/negation-4.png differ diff --git a/docs/reference/ordinate.html b/docs/reference/ordinate.html index 06a0667..cea3413 100644 --- a/docs/reference/ordinate.html +++ b/docs/reference/ordinate.html @@ -166,30 +166,30 @@

    Examples

    #> # Rows (symmetric): [ 10 x 3 | 1 ] #> PCo1 PCo2 PCo3 | name #> | <chr> -#> 1 -719. 143. -35.1 | 1 Atlanta -#> 2 -382. -341. -29.6 | 2 Chicago -#> 3 482. -25.3 -53.4 | 3 Denver -#> 4 -161. 573. -1.45 | 4 Houston -#> 5 1204. 390. 18.6 | 5 LosAngeles -#> 6 -1134. 582. 32.3 | 6 Miami -#> 7 -1072. -519. 34.3 | 7 NewYork -#> 8 1421. 113. 7.75 | 8 SanFrancisco -#> 9 1342. -580. 23.7 | 9 Seattle -#> 10 -980. -335. 2.90 | 10 Washington.DC +#> 1 -719. 143. 35.1 | 1 Atlanta +#> 2 -382. -341. 29.6 | 2 Chicago +#> 3 482. -25.3 53.4 | 3 Denver +#> 4 -161. 573. 1.45 | 4 Houston +#> 5 1204. 390. -18.6 | 5 LosAngeles +#> 6 -1134. 582. -32.3 | 6 Miami +#> 7 -1072. -519. -34.3 | 7 NewYork +#> 8 1421. 113. -7.75 | 8 SanFrancisco +#> 9 1342. -580. -23.7 | 9 Seattle +#> 10 -980. -335. -2.90 | 10 Washington.DC #> # #> # Columns (symmetric): [ 10 x 3 | 1 ] #> PCo1 PCo2 PCo3 | name #> | <chr> -#> 1 -719. 143. -35.1 | 1 Atlanta -#> 2 -382. -341. -29.6 | 2 Chicago -#> 3 482. -25.3 -53.4 | 3 Denver -#> 4 -161. 573. -1.45 | 4 Houston -#> 5 1204. 390. 18.6 | 5 LosAngeles -#> 6 -1134. 582. 32.3 | 6 Miami -#> 7 -1072. -519. 34.3 | 7 NewYork -#> 8 1421. 113. 7.75 | 8 SanFrancisco -#> 9 1342. -580. 23.7 | 9 Seattle -#> 10 -980. -335. 2.90 | 10 Washington.DC +#> 1 -719. 143. 35.1 | 1 Atlanta +#> 2 -382. -341. 29.6 | 2 Chicago +#> 3 482. -25.3 53.4 | 3 Denver +#> 4 -161. 573. 1.45 | 4 Houston +#> 5 1204. 390. -18.6 | 5 LosAngeles +#> 6 -1134. 582. -32.3 | 6 Miami +#> 7 -1072. -519. -34.3 | 7 NewYork +#> 8 1421. 113. -7.75 | 8 SanFrancisco +#> 9 1342. -580. -23.7 | 9 Seattle +#> 10 -980. -335. -2.90 | 10 Washington.DC # PCA of iris data ordinate(iris, princomp, cols = -Species, augment = c(Sepal.Width, Species)) @@ -290,20 +290,20 @@

    Examples

    #> # Rows (principal): [ 153 x 2 | 4 ] #> LD1 LD2 | name prior counts .element #> | <chr> <dbl> <int> <chr> -#> 1 7.61 0.215 | 1 setosa 0.333 50 active -#> 2 -1.83 -0.728 | 2 versicolor 0.333 50 active -#> 3 -5.78 0.513 | 3 virginica 0.333 50 active -#> 4 8.06 0.300 | 4 NA NA NA score -#> 5 7.13 -0.787 | 5 NA NA NA score +#> 1 7.61 -0.215 | 1 setosa 0.333 50 active +#> 2 -1.83 0.728 | 2 versicolor 0.333 50 active +#> 3 -5.78 -0.513 | 3 virginica 0.333 50 active +#> 4 8.06 -0.300 | 4 NA NA NA score +#> 5 7.13 0.787 | 5 NA NA NA score #> # ℹ 148 more rows #> # #> # Columns (standard): [ 4 x 2 | 2 ] #> LD1 LD2 | name .element #> | <chr> <chr> -#> 1 0.829 0.0241 | 1 Sepal.Length active -#> 2 1.53 2.16 | 2 Sepal.Width active -#> 3 -2.20 -0.932 | 3 Petal.Length active -#> 4 -2.81 2.84 | 4 Petal.Width active +#> 1 0.829 -0.0241 | 1 Sepal.Length active +#> 2 1.53 -2.16 | 2 Sepal.Width active +#> 3 -2.20 0.932 | 3 Petal.Length active +#> 4 -2.81 -2.84 | 4 Petal.Width active # CCA of savings data ordinate( diff --git a/docs/reference/plot.tbl_ord-1.png b/docs/reference/plot.tbl_ord-1.png index 8feca7c..3d3af49 100644 Binary files a/docs/reference/plot.tbl_ord-1.png and b/docs/reference/plot.tbl_ord-1.png differ diff --git a/docs/reference/plot.tbl_ord-11.png b/docs/reference/plot.tbl_ord-11.png index 47a3fa9..a8c6528 100644 Binary files a/docs/reference/plot.tbl_ord-11.png and b/docs/reference/plot.tbl_ord-11.png differ diff --git a/docs/reference/plot.tbl_ord-2.png b/docs/reference/plot.tbl_ord-2.png index 8d86db0..5699ba6 100644 Binary files a/docs/reference/plot.tbl_ord-2.png and b/docs/reference/plot.tbl_ord-2.png differ diff --git a/docs/reference/plot.tbl_ord-3.png b/docs/reference/plot.tbl_ord-3.png index 8feca7c..3d3af49 100644 Binary files a/docs/reference/plot.tbl_ord-3.png and b/docs/reference/plot.tbl_ord-3.png differ diff --git a/docs/reference/plot.tbl_ord-4.png b/docs/reference/plot.tbl_ord-4.png index bb15f92..680b5c2 100644 Binary files a/docs/reference/plot.tbl_ord-4.png and b/docs/reference/plot.tbl_ord-4.png differ diff --git a/docs/reference/plot.tbl_ord-6.png b/docs/reference/plot.tbl_ord-6.png index c61d118..4915e9b 100644 Binary files a/docs/reference/plot.tbl_ord-6.png and b/docs/reference/plot.tbl_ord-6.png differ diff --git a/docs/reference/plot.tbl_ord-8.png b/docs/reference/plot.tbl_ord-8.png index 47a3fa9..a8c6528 100644 Binary files a/docs/reference/plot.tbl_ord-8.png and b/docs/reference/plot.tbl_ord-8.png differ diff --git a/docs/reference/plot.tbl_ord-9.png b/docs/reference/plot.tbl_ord-9.png index 9cdf40f..b31f4ba 100644 Binary files a/docs/reference/plot.tbl_ord-9.png and b/docs/reference/plot.tbl_ord-9.png differ diff --git a/docs/reference/qswur_usa-1.png b/docs/reference/qswur_usa-1.png index 36c7611..5be3b4f 100644 Binary files a/docs/reference/qswur_usa-1.png and b/docs/reference/qswur_usa-1.png differ diff --git a/docs/reference/stat_bagplot-1.png b/docs/reference/stat_bagplot-1.png index 2e7e305..d000bf7 100644 Binary files a/docs/reference/stat_bagplot-1.png and b/docs/reference/stat_bagplot-1.png differ diff --git a/docs/reference/stat_center-2.png b/docs/reference/stat_center-2.png index ae3bf0c..d2d3d72 100644 Binary files a/docs/reference/stat_center-2.png and b/docs/reference/stat_center-2.png differ diff --git a/docs/reference/stat_chull-2.png b/docs/reference/stat_chull-2.png index e5a60d6..5776a1a 100644 Binary files a/docs/reference/stat_chull-2.png and b/docs/reference/stat_chull-2.png differ diff --git a/docs/reference/stat_cone-1.png b/docs/reference/stat_cone-1.png index 8114298..85a18e8 100644 Binary files a/docs/reference/stat_cone-1.png and b/docs/reference/stat_cone-1.png differ diff --git a/docs/reference/stat_rule-1.png b/docs/reference/stat_rule-1.png index 592a79c..1f91400 100644 Binary files a/docs/reference/stat_rule-1.png and b/docs/reference/stat_rule-1.png differ diff --git a/docs/reference/stat_rule-2.png b/docs/reference/stat_rule-2.png index 4a9a803..340bd92 100644 Binary files a/docs/reference/stat_rule-2.png and b/docs/reference/stat_rule-2.png differ diff --git a/docs/reference/stat_rule.html b/docs/reference/stat_rule.html index abb0a23..3777436 100644 --- a/docs/reference/stat_rule.html +++ b/docs/reference/stat_rule.html @@ -300,22 +300,22 @@

    Examples

    #> # Rows (principal): [ 72 x 3 | 5 ] #> LD1 LD2 LD3 | name prior counts grouping #> | <chr> <dbl> <int> <chr> -#> 1 1.82 1.21 0.672 | 1 Apollonia 0.132 9 Apollon… -#> 2 -5.62 -0.364 0.00398 | 2 Banias 0.265 18 Banias -#> 3 2.47 -1.63 -0.0833 | 3 Bet Eli'ez… 0.397 27 Bet Eli… -#> 4 1.31 2.84 -0.277 | 4 Dor 0.206 14 Dor -#> 5 2.99 -2.03 1.22 | 5 1 NA NA Bet Eli… +#> 1 1.82 -1.21 -0.672 | 1 Apollonia 0.132 9 Apollon… +#> 2 -5.62 0.364 -0.00398 | 2 Banias 0.265 18 Banias +#> 3 2.47 1.63 0.0833 | 3 Bet Eli'ez… 0.397 27 Bet Eli… +#> 4 1.31 -2.84 0.277 | 4 Dor 0.206 14 Dor +#> 5 2.99 2.03 -1.22 | 5 1 NA NA Bet Eli… #> # ℹ 67 more rows #> # ℹ 1 more variable: .element <chr> #> # #> # Columns (standard): [ 5 x 3 | 2 ] -#> LD1 LD2 LD3 | name .element -#> | <chr> <chr> -#> 1 0.00681 -0.618 -0.468 | 1 SiO2 active -#> 2 2.05 -1.04 0.660 | 2 Al2O3 active -#> 3 -1.93 -0.165 -2.44 | 3 FeO active -#> 4 -1.76 -1.82 0.599 | 4 MgO active -#> 5 -0.275 -0.0942 -1.42 | 5 CaO active +#> LD1 LD2 LD3 | name .element +#> | <chr> <chr> +#> 1 0.00681 0.618 0.468 | 1 SiO2 active +#> 2 2.05 1.04 -0.660 | 2 Al2O3 active +#> 3 -1.93 0.165 2.44 | 3 FeO active +#> 4 -1.76 1.82 -0.599 | 4 MgO active +#> 5 -0.275 0.0942 1.42 | 5 CaO active # row-standard biplot glass_lda %>% confer_inertia(1) %>% @@ -326,14 +326,13 @@

    Examples

    stat_cols_rule( aes(label = name), color = "#888888", num = 8L, ref_elements = "score", fun.offset = \(x) minabspp(x, p = .1), - text_size = 2.5, label_dodge = .02 + text.size = 2.5, label_dodge = .04 ) + scale_shape_manual(values = c(2L, 3L, 0L, 5L)) + ggtitle( "LDA of Freestone glass measurements", "Row-standard biplot of standardized LDA" ) -#> Warning: Ignoring unknown parameters: `text_size` # contribution LDA of sites on measurements @@ -350,22 +349,22 @@

    Examples

    #> # Rows (principal): [ 72 x 3 | 5 ] #> LD1 LD2 LD3 | name prior counts grouping #> | <chr> <dbl> <int> <chr> -#> 1 1.82 1.21 0.672 | 1 Apollonia 0.132 9 Apollon… -#> 2 -5.62 -0.364 0.00398 | 2 Banias 0.265 18 Banias -#> 3 2.47 -1.63 -0.0833 | 3 Bet Eli'ez… 0.397 27 Bet Eli… -#> 4 1.31 2.84 -0.277 | 4 Dor 0.206 14 Dor -#> 5 2.99 -2.03 1.22 | 5 1 NA NA Bet Eli… +#> 1 1.82 -1.21 -0.672 | 1 Apollonia 0.132 9 Apollon… +#> 2 -5.62 0.364 -0.00398 | 2 Banias 0.265 18 Banias +#> 3 2.47 1.63 0.0833 | 3 Bet Eli'ez… 0.397 27 Bet Eli… +#> 4 1.31 -2.84 0.277 | 4 Dor 0.206 14 Dor +#> 5 2.99 2.03 -1.22 | 5 1 NA NA Bet Eli… #> # ℹ 67 more rows #> # ℹ 1 more variable: .element <chr> #> # #> # Columns (standard): [ 5 x 3 | 2 ] #> LD1 LD2 LD3 | name .element #> | <chr> <chr> -#> 1 0.166 -0.871 -0.160 | 1 SiO2 active -#> 2 0.663 -0.164 -0.0442 | 2 Al2O3 active -#> 3 -0.142 -0.112 -0.192 | 3 FeO active -#> 4 -0.680 -0.367 0.0694 | 4 MgO active -#> 5 -0.0804 0.151 -0.941 | 5 CaO active +#> 1 0.166 0.871 0.160 | 1 SiO2 active +#> 2 0.663 0.164 0.0442 | 2 Al2O3 active +#> 3 -0.142 0.112 0.192 | 3 FeO active +#> 4 -0.680 0.367 -0.0694 | 4 MgO active +#> 5 -0.0804 -0.151 0.941 | 5 CaO active # symmetric biplot glass_lda %>% confer_inertia(.5) %>% @@ -376,14 +375,13 @@

    Examples

    stat_cols_rule( aes(label = name), geom = "axis", color = "#888888", num = 8L, ref_elements = "active", fun.offset = \(x) minabspp(x, p = .1), - text_size = 2.5, text_dodge = .025 + label_dodge = 0.04, text.size = 2.5, text_dodge = .025 ) + scale_shape_manual(values = c(16L, 17L, 15L, 18L)) + ggtitle( "LDA of Freestone glass measurements", "Symmetric biplot of contribution LDA" ) -#> Warning: Ignoring unknown parameters: `text_size` diff --git a/docs/reference/tbl_ord.html b/docs/reference/tbl_ord.html index 6f359f6..dca8f21 100644 --- a/docs/reference/tbl_ord.html +++ b/docs/reference/tbl_ord.html @@ -272,7 +272,7 @@

    Examples

    #> La Vallee 1.11176971 -0.7484136 -0.66355682 #> Lavaux -0.45759227 -0.8101884 -0.57253943 #> Morges -0.16023764 -0.8189392 -0.35143678 -#> Moudon -0.76689425 -0.8871886 -0.73359873 +#> Moudon -0.76689426 -0.8871886 -0.73359873 #> Nyone 0.01148304 -0.4441114 -1.18020392 #> Orbe -0.53346789 -0.8042945 -1.34826105 #> Oron -1.11777160 -1.0181496 -0.21175864 diff --git a/docs/reference/tidiers.html b/docs/reference/tidiers.html index 2d29102..8059679 100644 --- a/docs/reference/tidiers.html +++ b/docs/reference/tidiers.html @@ -216,7 +216,7 @@

    Examples

    #> # A tibble: 1 × 7 #> rank n.row n.col inertia prop.var.1 prop.var.2 class #> <int> <int> <int> <dbl> <dbl> <dbl> <chr> -#> 1 4 150 4 596 0.730 0.229 prcomp +#> 1 4 150 4 596. 0.730 0.229 prcomp # this enables comparisons to other models rbind( glance(ordinate(subset(iris, Species == "setosa"), prcomp, seq(4L))), diff --git a/docs/reference/wrap-ord.html b/docs/reference/wrap-ord.html index 7995d43..c49745d 100644 --- a/docs/reference/wrap-ord.html +++ b/docs/reference/wrap-ord.html @@ -188,16 +188,16 @@

    Examples

    #> eigen() decomposition #> $values #> [1] 3.617285e+00 1.467376e-01 8.282650e-02 1.360291e-02 1.141672e-04 -#> [6] 6.230496e-19 +#> [6] 4.279624e-17 #> #> $vectors #> EV1 EV2 EV3 EV4 EV5 EV6 -#> SiO2 0.8469970 0.31716695 -0.25837288 -0.11577441 -0.2822267 0.1489597 -#> Na2O 0.2099520 -0.79170694 -0.10021025 -0.51787194 0.1385212 0.1780413 -#> CaO -0.4260986 0.04199369 -0.76882445 -0.05663831 -0.3233201 0.3432808 -#> Al2O3 -0.1556273 0.45906193 -0.08066526 -0.77062798 0.2878426 -0.2860325 -#> MgO -0.1492104 -0.07286372 0.38010592 -0.30504020 -0.8407925 -0.1672273 -#> K2O -0.1023356 0.23408287 0.42558539 -0.16816668 0.0826960 0.8476385 +#> SiO2 0.8469970 0.31716695 -0.25837288 -0.11577441 0.2822267 0.1489597 +#> Na2O 0.2099520 -0.79170694 -0.10021025 -0.51787194 -0.1385212 0.1780413 +#> CaO -0.4260986 0.04199369 -0.76882445 -0.05663831 0.3233201 0.3432808 +#> Al2O3 -0.1556273 0.45906193 -0.08066526 -0.77062798 -0.2878426 -0.2860325 +#> MgO -0.1492104 -0.07286372 0.38010592 -0.30504020 0.8407925 -0.1672273 +#> K2O -0.1023356 0.23408287 0.42558539 -0.16816668 -0.0826960 0.8476385 #> # singular value decomposition of a data matrix svd_ord(glass_banias) @@ -238,7 +238,7 @@

    Examples

    #> #> $eig #> [1] 1.808643e+01 7.336881e-01 4.141325e-01 6.801456e-02 5.708361e-04 -#> [6] 2.355381e-16 +#> [6] 6.300478e-16 #> #> $x #> [,1] [,2] [,3] [,4] [,5] [,6] @@ -271,20 +271,20 @@

    Examples

    #> [1] 1 1 1 1 1 #> #> $xcoef -#> [,1] [,2] [,3] [,4] [,5] -#> SiO2 1.5208338 -11.442468 0.24637620 -3.6336531 -2.879401 -#> Na2O 0.6162264 4.530578 0.49288317 0.9782368 2.843217 -#> CaO 1.9784095 -13.380217 -0.02445709 -5.2899746 -3.775547 -#> Al2O3 0.9152174 11.763052 1.76949275 4.7132684 4.535237 -#> MgO 3.8891975 -32.462610 -0.81337485 -8.8720942 -6.686017 +#> [,1] [,2] [,3] [,4] [,5] +#> SiO2 -2.296248 -11.369291 -2.825844 -1.997054 -2.879401 +#> Na2O 1.035333 3.948798 1.016188 2.099571 2.843217 +#> CaO -1.915708 -13.652940 -3.999884 -2.203852 -3.775547 +#> Al2O3 1.133790 11.090690 4.050155 4.884709 4.535237 +#> MgO -7.830795 -31.099321 -8.668147 -6.685554 -6.686017 #> #> $ycoef -#> [,1] [,2] [,3] [,4] [,5] -#> TiO2 1.726017 -2.948854 1.0731891 1.910721 2.960014 -#> FeO 1.644821 1.607463 -0.7174584 -7.612725 0.000000 -#> MnO -2.274981 3.129723 -3.8589747 -4.606006 0.000000 -#> P2O5 2.274901 -22.265078 2.1204758 5.301190 0.000000 -#> Cl -10.072183 10.842238 -9.3884609 -23.471152 0.000000 +#> [,1] [,2] [,3] [,4] [,5] +#> TiO2 -3.214755 -2.257585 0.6077935 0.8226229 2.960014 +#> FeO 6.509558 -1.818302 -3.6350924 2.2052729 0.000000 +#> MnO 5.290203 2.278202 -3.6872234 -2.0749981 0.000000 +#> P2O5 -14.417571 -17.411690 0.3602733 -4.7270262 0.000000 +#> Cl 25.883235 3.745439 -11.0966777 -7.1368602 0.000000 #> #> $xcenter #> SiO2 Na2O CaO Al2O3 MgO K2O @@ -303,24 +303,24 @@

    Examples

    # scores glass_cca$xscores #> [,1] [,2] [,3] -#> [1,] 0.08625757 -0.564009626 -0.5086737 -#> [2,] -0.06325679 -0.009686013 -0.4449230 -#> [3,] -0.31243762 0.589123478 -0.1458326 -#> [4,] 0.85114073 0.156299524 0.2733283 -#> [5,] -0.34697599 -0.470284132 0.6433738 -#> [6,] -0.21472789 0.298556769 0.1827271 +#> [1,] 0.08625757 0.564009626 0.5086737 +#> [2,] -0.06325679 0.009686013 0.4449230 +#> [3,] -0.31243762 -0.589123478 0.1458326 +#> [4,] 0.85114073 -0.156299524 -0.2733283 +#> [5,] -0.34697599 0.470284132 -0.6433738 +#> [6,] -0.21472789 -0.298556769 -0.1827271 # intraset correlations glass_cca$xstructure -#> [,1] [,2] [,3] -#> SiO2 -0.9261925 -0.3749912 -0.03935800 -#> Na2O -0.5467957 -0.5715073 -0.61187732 -#> CaO 0.7639885 0.6435255 -0.04686735 +#> [,1] [,2] [,3] +#> SiO2 -0.9261925 0.3749912 0.03935800 +#> Na2O -0.5467957 0.5715073 0.61187732 +#> CaO 0.7639885 -0.6435255 0.04686735 # interset correlations glass_cca$xstructure %*% diag(glass_cca$cor) -#> [,1] [,2] [,3] -#> SiO2 -0.9261925 -0.3594308 -0.02748688 -#> Na2O -0.5467957 -0.5477923 -0.42732349 -#> CaO 0.7639885 0.6168220 -0.03273126 +#> [,1] [,2] [,3] +#> SiO2 -0.9261925 0.3594308 0.02748688 +#> Na2O -0.5467957 0.5477923 0.42732349 +#> CaO 0.7639885 -0.6168220 0.03273126 diff --git a/inst/examples/ex-geom-isoline-glass.r b/inst/examples/ex-geom-isoline-glass.r index fbcc796..5a103b7 100644 --- a/inst/examples/ex-geom-isoline-glass.r +++ b/inst/examples/ex-geom-isoline-glass.r @@ -16,7 +16,7 @@ glass_lda %>% geom_rows_text() + geom_cols_vector(subset = c(1, 3, 4), size = 3) + geom_cols_isoline(subset = c(1, 3, 4), alpha = .25, num = 4L, - label_dodge = -.03, text_alpha = .5, text_size = 3) + + text_dodge = -.03, text.alpha = .5, text.size = 3) + ggtitle( "LDA of Freestone glass measurements", "Row-standard biplot of standardized LDA" diff --git a/inst/examples/ex-methods-kmeans-iris.r b/inst/examples/ex-methods-kmeans-iris.r index f461a17..687e647 100644 --- a/inst/examples/ex-methods-kmeans-iris.r +++ b/inst/examples/ex-methods-kmeans-iris.r @@ -36,8 +36,8 @@ iris_km_ord %>% ggbiplot(aes(x = `2`, y = `3`), color = factor(.cluster)) + geom_jitter(stat = "rows", aes(shape = cluster), width = .2, height = .2) + geom_cols_axis(aes(color = `1`, label = name), - text_size = 2, text_dodge = .1, - label_size = 3, label_alpha = .5) + + text.size = 2, text_dodge = .1, + size = 3, label.alpha = .5) + scale_x_continuous(expand = expansion(mult = .8)) + scale_y_continuous(expand = expansion(mult = .5)) + ggtitle( diff --git a/inst/examples/ex-stat-rule-glass.r b/inst/examples/ex-stat-rule-glass.r index 7b111e5..664d218 100644 --- a/inst/examples/ex-stat-rule-glass.r +++ b/inst/examples/ex-stat-rule-glass.r @@ -17,7 +17,7 @@ glass_lda %>% stat_cols_rule( aes(label = name), color = "#888888", num = 8L, ref_elements = "score", fun.offset = \(x) minabspp(x, p = .1), - text_size = 2.5, label_dodge = .02 + text.size = 2.5, label_dodge = .04 ) + scale_shape_manual(values = c(2L, 3L, 0L, 5L)) + ggtitle( @@ -43,7 +43,7 @@ glass_lda %>% stat_cols_rule( aes(label = name), geom = "axis", color = "#888888", num = 8L, ref_elements = "active", fun.offset = \(x) minabspp(x, p = .1), - text_size = 2.5, text_dodge = .025 + label_dodge = 0.04, text.size = 2.5, text_dodge = .025 ) + scale_shape_manual(values = c(16L, 17L, 15L, 18L)) + ggtitle( diff --git a/man/biplot-geoms.Rd b/man/biplot-geoms.Rd index 9cfdc59..ba6d8c4 100644 --- a/man/biplot-geoms.Rd +++ b/man/biplot-geoms.Rd @@ -630,6 +630,11 @@ geom_rows_isoline( num = NULL, text_dodge = 0.03, ..., + text.size = 3, + text.angle = 0, + text.colour = NULL, + text.color = NULL, + text.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = FALSE, @@ -647,6 +652,11 @@ geom_cols_isoline( num = NULL, text_dodge = 0.03, ..., + text.size = 3, + text.angle = 0, + text.colour = NULL, + text.color = NULL, + text.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = FALSE, @@ -774,6 +784,11 @@ geom_rows_vector( linejoin = "mitre", vector_labels = TRUE, ..., + label.colour = NULL, + label.color = NULL, + label.alpha = NULL, + parse = FALSE, + check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -789,6 +804,11 @@ geom_cols_vector( linejoin = "mitre", vector_labels = TRUE, ..., + label.colour = NULL, + label.color = NULL, + label.alpha = NULL, + parse = FALSE, + check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE diff --git a/man/geom_isoline.Rd b/man/geom_isoline.Rd index 607394e..a052d68 100644 --- a/man/geom_isoline.Rd +++ b/man/geom_isoline.Rd @@ -14,6 +14,11 @@ geom_isoline( num = NULL, text_dodge = 0.03, ..., + text.size = 3, + text.angle = 0, + text.colour = NULL, + text.color = NULL, + text.alpha = NULL, parse = FALSE, check_overlap = FALSE, na.rm = FALSE, @@ -79,6 +84,10 @@ or isoline, as a proportion of the minimum of the plot width and height.} \item{...}{Additional arguments passed to \code{\link[ggplot2:layer]{ggplot2::layer()}}.} +\item{text.size, text.angle, text.colour, text.color, text.alpha}{Default +aesthetics for tick mark labels. Set to NULL to inherit from the data's +aesthetics.} + \item{parse}{If \code{TRUE}, the labels will be parsed into expressions and displayed as described in \code{?plotmath}.} @@ -141,12 +150,8 @@ are in bold): \item \code{vjust} \item \code{family} \item \code{fontface} -\item \code{text_colour}, \code{text_alpha}, \code{text_size}, \code{text_angle}, \item \code{group} } - -The prefixed aesthetics \verb{text_*} are used by the text elements and will -inherit any values passed to their un-prefixed counterparts. } \examples{ diff --git a/man/geom_vector.Rd b/man/geom_vector.Rd index 4c73d76..48a78ff 100644 --- a/man/geom_vector.Rd +++ b/man/geom_vector.Rd @@ -14,6 +14,11 @@ geom_vector( linejoin = "mitre", vector_labels = TRUE, ..., + label.colour = NULL, + label.color = NULL, + label.alpha = NULL, + parse = FALSE, + check_overlap = FALSE, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE @@ -78,6 +83,9 @@ from the vectors.} \item{...}{Additional arguments passed to \code{\link[ggplot2:layer]{ggplot2::layer()}}.} +\item{label.colour, label.color, label.alpha}{Default aesthetics for labels. +Set to NULL to inherit from the data's aesthetics.} + \item{na.rm}{Passed to \code{\link[ggplot2:layer]{ggplot2::layer()}}.} \item{show.legend}{logical. Should this layer be included in the legends? @@ -133,9 +141,12 @@ are in bold): \item \code{linetype} \item \code{label} \item \code{size} -\item \code{angle}, \code{hjust}, \code{vjust} -\item \code{label_colour}, \code{label_alpha} -\item \code{family}, \code{fontface}, \code{lineheight} +\item \code{angle} +\item \code{hjust} +\item \code{vjust} +\item \code{family} +\item \code{fontface} +\item \code{lineheight} \item \code{group} } } diff --git a/man/methods-kmeans.Rd b/man/methods-kmeans.Rd index f57d183..d6058cb 100644 --- a/man/methods-kmeans.Rd +++ b/man/methods-kmeans.Rd @@ -81,8 +81,8 @@ iris_km_ord \%>\% ggbiplot(aes(x = `2`, y = `3`), color = factor(.cluster)) + geom_jitter(stat = "rows", aes(shape = cluster), width = .2, height = .2) + geom_cols_axis(aes(color = `1`, label = name), - text_size = 2, text_dodge = .1, - label_size = 3, label_alpha = .5) + + text.size = 2, text_dodge = .1, + size = 3, label.alpha = .5) + scale_x_continuous(expand = expansion(mult = .8)) + scale_y_continuous(expand = expansion(mult = .5)) + ggtitle( diff --git a/man/stat_rule.Rd b/man/stat_rule.Rd index b5cfeb5..388973f 100644 --- a/man/stat_rule.Rd +++ b/man/stat_rule.Rd @@ -187,7 +187,7 @@ glass_lda \%>\% stat_cols_rule( aes(label = name), color = "#888888", num = 8L, ref_elements = "score", fun.offset = \(x) minabspp(x, p = .1), - text_size = 2.5, label_dodge = .02 + text.size = 2.5, label_dodge = .04 ) + scale_shape_manual(values = c(2L, 3L, 0L, 5L)) + ggtitle( @@ -213,7 +213,7 @@ glass_lda \%>\% stat_cols_rule( aes(label = name), geom = "axis", color = "#888888", num = 8L, ref_elements = "active", fun.offset = \(x) minabspp(x, p = .1), - text_size = 2.5, text_dodge = .025 + label_dodge = 0.04, text.size = 2.5, text_dodge = .025 ) + scale_shape_manual(values = c(16L, 17L, 15L, 18L)) + ggtitle(