diff --git a/NAMESPACE b/NAMESPACE index 76ccb40..935bc69 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -52,6 +52,7 @@ export(get_space_param) export(get_start) export(get_theo) export(plot_projection) +export(prep_huber) export(prep_space_tour) export(sample_bases) export(scale_color_continuous_botanical) diff --git a/R/huber-plot.R b/R/huber-plot.R index a41147c..8118c97 100644 --- a/R/huber-plot.R +++ b/R/huber-plot.R @@ -5,8 +5,29 @@ #' @param index a function, the projection pursuit index function, see examples #' @rdname huber #' @export +#' @examples +#' library(ggplot2) +#' library(tourr) +#' data(randu) +#' randu_std <- as.data.frame(apply(randu, 2, function(x) (x-mean(x))/sd(x))) +#' randu_std$yz <- sqrt(35)/6*randu_std$y-randu_std$z/6 +#' randu_df <- randu_std[c(1,4)] +#' randu_huber <- prep_huber(randu_df, index = norm_bin(nr = nrow(randu_df))) +#' +#' ggplot() + +#' geom_huber(data = randu_huber$idx_df, aes(x = x, y = y)) + +#' geom_point(data = randu_df, aes(x = x, y = yz)) + +#' geom_abline(slope = randu_huber$slope, intercept = 0) + +#' theme_huber() + +#' coord_fixed() +#' +#' ggplot(randu_huber$proj_df, aes(x = x)) + +#' geom_histogram(breaks = seq(-2.2, 2.4, 0.12)) + +#' xlab("") + ylab("") + +#' theme_bw() + +#' theme(axis.text.y = element_blank()) geom_huber <- function(mapping = NULL, data = NULL, stat = "identity", - position = "identity", ..., index = NULL, + position = "identity", ..., show.legend = NA, inherit.aes = TRUE) { ggplot2::layer( data = data, @@ -16,7 +37,7 @@ geom_huber <- function(mapping = NULL, data = NULL, stat = "identity", position = position, show.legend = show.legend, inherit.aes = inherit.aes, - params = list(index = list(index), ...) + params = list(...) ) } @@ -34,24 +55,7 @@ GeomHuber <- ggplot2::ggproto( dplyr::mutate(linetype = "dashed") data_huber <- data |> dplyr::filter(type == "huber") - # https://github.com/tidyverse/ggplot2/blob/HEAD/R/geom-abline.R - ranges <- coord$backtransform_range(panel_params) - if (coord$clip == "on" && coord$is_linear()) { - # Ensure the line extends well outside the panel to avoid visible line - # ending for thick lines - ranges$x <- ranges$x + c(-1, 1) * diff(ranges$x) - } - - data_best <- data - data_best$x <- ranges$x[1] - data_best$xend <- ranges$x[2] - data_best$y <- ranges$x[1] * unique(data$slope) # intercept is always 0 - data_best$yend <- ranges$x[2] * unique(data$slope) - data_best$linetype <- "solid" - grid::gList( - ggplot2::GeomSegment$draw_panel(data_best, panel_params, coord, - lineend = lineend), ggplot2::GeomPath$draw_panel(data_circle, panel_params, coord, ...), ggplot2::GeomPath$draw_panel(data_huber, panel_params, coord, ...) ) @@ -66,34 +70,40 @@ GeomHuber <- ggplot2::ggproto( ) ) -huber_data_setup <- function(data, params){ - index_f <- params$index[[1]] +huber_data_setup <- function(data, param){ + theta <- pi/180 * (0:(nrow(data) - 1)) + res1 <- data |> dplyr::mutate(type = "huber") + res2 <- data |> dplyr::mutate( + x = 4 * cos(theta), + y = 4 * sin(theta), + type = "circle") + res <- dplyr::bind_rows(res1, res2) + return(res) + +} + +#' @export +#' @rdname huber +prep_huber <- function(data, index){ + data <- as.matrix(data) + index_f <- index res <- tibble::tibble(i = 0:360, theta = pi/180 * i) |> dplyr::rowwise() |> dplyr::mutate( - proj_data = list(as.matrix(cos(theta) * data$x + sin(theta) * data$y)), - index = index_f(proj_data), - PANEL = 1, group = -1, alpha = params$alpha) |> - dplyr::ungroup() - - res1 <- res |> + proj_data = list(as.matrix(cos(theta) * data[,1] + sin(theta) * data[,2])), + index = index_f(proj_data)) |> + dplyr::ungroup() |> dplyr::mutate( range = round(max(index) - min(index), 5), idx_scaled = (index - min(index))/range * 2 + 3, x = idx_scaled * cos(theta), - y = idx_scaled * sin(theta), - type = "huber") - - res2 <- res |> dplyr::mutate( - x = 4 * cos(theta), - y = 4 * sin(theta), - type = "circle") + y = idx_scaled * sin(theta)) - res <- dplyr::bind_rows(res1, res2) sel_idx <- which(res$index[1:360] > signif(max(res$index), 6) - 1e-06) theta_best <- pi/180 * (sel_idx - 1) - res <- res |> dplyr::mutate(slope = sin(theta_best)/cos(theta_best)) - return(res) + slope <- sin(theta_best)/cos(theta_best) + proj_df <- tibble::tibble(x = cos(theta_best) * data[, 1] + sin(theta_best) * data[, 2]) + return(list(idx_df = res, proj_df = proj_df, slope = slope)) } diff --git a/_pkgdown.yml b/_pkgdown.yml index a9058d7..50911fe 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -17,6 +17,7 @@ reference: - explore_space_tour - plot_projection - flip_sign + - geom_huber - title: Get components desc: > Extracting components from existing data object diff --git a/docs/404.html b/docs/404.html index 22740ea..bea073c 100644 --- a/docs/404.html +++ b/docs/404.html @@ -31,7 +31,7 @@ - +
@@ -62,7 +62,7 @@
  • - +
  • @@ -73,7 +73,7 @@
    - +
    @@ -101,16 +101,16 @@

    Page not found (404)

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/index.html b/docs/index.html index eaf52c1..e03e336 100644 --- a/docs/index.html +++ b/docs/index.html @@ -32,7 +32,7 @@ - +
    @@ -63,7 +63,7 @@
  • - +
  • @@ -74,17 +74,18 @@
    - +
    +
    -

    The ferrn package extracts key components from the data object collected during projection pursuit (PP) guided tour optimisation, produces diagnostic plots, and calculates PP index scores. An associated paper can be found at https://journal.r-project.org/archive/2021/RJ-2021-105/index.html.

    +

    The ferrn package extracts key components from the data object collected during projection pursuit (PP) guided tour optimisation, produces diagnostic plots, and calculates PP index scores.

    Installation

    @@ -94,7 +95,7 @@

    Installationremotes::install_github("huizezhang-sherry/ferrn")

    -

    Examples +

    Visualise PP optimisation

    The data object collected during a PP optimisation can be obtained by assigning the tourr::annimate_xx() function a name. In the following example, the projection pursuit is finding the best projection basis that can detect multi-modality for the boa5 dataset using the holes() index function and the optimiser search_better:

    @@ -129,11 +130,11 @@ 

    Examples explore_trace_interp() + scale_color_continuous_botanical()

    -

    Different optimisers can be compared by plotting their projection bases on the reduced PCA space. Here holes_1d_geo is the data obtained from the same PP problem as holes_1d_better introduced above, but with a search_geodesic optimiser. The 5 × 1 bases from the two datasets are first reduced to 2D via PCA, and then plotted to the PCA space. (PP bases are ortho-normal and the space for n × 1 bases is an n-d sphere, hence a circle when projected into 2D.)

    +

    Different optimisers can be compared by plotting their projection bases on the reduced PCA space. Here holes_1d_geo is the data obtained from the same PP problem as holes_1d_better introduced above, but with a search_geodesic optimiser. The 5 ×\times 1 bases from the two datasets are first reduced to 2D via PCA, and then plotted to the PCA space. (PP bases are ortho-normal and the space for n×1n \times 1 bases is an nn-d sphere, hence a circle when projected into 2D.)

     bind_rows(holes_1d_geo, holes_1d_better) %>%
       bind_theoretical(matrix(c(0, 1, 0, 0, 0), nrow = 5),
    -                   index = tourr::holes(), raw_data = boa5) %>% 
    +                   index = tourr::holes(), raw_data = boa5) %>% 
       explore_space_pca(group = method, details = TRUE)  +
       scale_color_discrete_botanical()

    @@ -146,37 +147,23 @@

    Examples point_size = 2, end_size = 5)

    -
    -
    -holes <- function() {
    - function(mat) {
    -   n <- nrow(mat)
    -   d <- ncol(mat)
    -
    -   num <- 1 - 1 / n * sum(exp(-0.5 * rowSums(mat^2)))
    -   den <- 1 - exp(-d / 2)
    -
    -   num / den
    - }
    -}
    -
    -basis_smoothness <- sample_bases(idx = "holes")
    -calc_smoothness(basis_smoothness)
    -#> # PP index:     holes
    -#> # No. of bases: 300 [6 x 2]
    -#>     variance range smoothness nugget convergence
    -#>        <dbl> <dbl>      <dbl>  <dbl> <lgl>      
    -#> 1 0.00000672  18.1       1.03  1138. TRUE
    -basis_squint <- sample_bases(idx = "holes", n_basis = 100, step_size = 0.01, min_proj_dist = 1.5)
    -calc_squintability(basis_squint, method = "ks", bin_width = 0.01)
    -#> # PP index:     holes
    -#> # No. of bases: 100 -> 17159
    -#> # method:       ks
    -#>   max_x max_d squint
    -#>   <dbl> <dbl>  <dbl>
    -#> 1  1.87 0.482  0.901
    + + + + + + + + + +
    +
    +

    Reference +

    +
    +
    - - + + diff --git a/docs/news/index.html b/docs/news/index.html index b4fdfd0..0d3568d 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -53,6 +53,16 @@

    Changelog

    Source: NEWS.md
    +
    + +
    +
    + +
    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index b726071..5acbd11 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 3.2.1 pkgdown: 2.1.0 pkgdown_sha: ~ articles: {} -last_built: 2024-09-07T15:44Z +last_built: 2024-09-10T20:30Z urls: reference: https://huizezhang-sherry.github.io/ferrn/reference article: https://huizezhang-sherry.github.io/ferrn/articles diff --git a/docs/reference/add_anchor.html b/docs/reference/add_anchor.html index ecea918..fa4f4bf 100644 --- a/docs/reference/add_anchor.html +++ b/docs/reference/add_anchor.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -66,37 +66,35 @@

    A ggproto for drawing anchor points

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    anchor_size
    +
    anchor_size

    numeric; the size of the anchor points

    -
    anchor_alpha
    +
    anchor_alpha

    numeric; the alpha of the anchor points

    -
    anchor_color
    +
    anchor_color

    the variable to be coloured by

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for drawing anchor points in explore_space_pca()

    - - +

    a wrapper for drawing anchor points in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anno(), add_dir_search(), add_end(), @@ -121,15 +119,15 @@

    See also

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/add_anno.html b/docs/reference/add_anno.html index 2e2bee3..9782bbf 100644 --- a/docs/reference/add_anno.html +++ b/docs/reference/add_anno.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -66,37 +66,35 @@

    A ggproto for annotating the symmetry of the starting points

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    anno_color
    +
    anno_color

    character; the colour of the annotation line

    -
    anno_lty
    +
    anno_lty

    character; the linetype of the annotation line

    -
    anno_alpha
    +
    anno_alpha

    numeric; the alpha of the annotation line

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for annotating the symmetry of start points in explore_space_pca()

    - - +

    a wrapper for annotating the symmetry of start points in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anchor(), add_dir_search(), add_end(), @@ -121,15 +119,15 @@

    See also

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/add_dir_search.html b/docs/reference/add_dir_search.html index 1510d0a..5e3fe3d 100644 --- a/docs/reference/add_dir_search.html +++ b/docs/reference/add_dir_search.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -66,37 +66,35 @@

    A ggproto for drawing directional search points

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    dir_size
    +
    dir_size

    numeric; the size of the directional search points in pseudo derivative search

    -
    dir_alpha
    +
    dir_alpha

    numeric; the alpha of the directional search points in pseudo derivative search

    -
    dir_color
    +
    dir_color

    the variable to be coloured by

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for drawing directional search points (used in pseudo derivative search) with buffer in explore_space_pca()

    - - +

    a wrapper for drawing directional search points (used in pseudo derivative search) with buffer in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anchor(), add_anno(), add_end(), @@ -121,15 +119,15 @@

    See also

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/add_end.html b/docs/reference/add_end.html index 1c22a7d..070d2e7 100644 --- a/docs/reference/add_end.html +++ b/docs/reference/add_end.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -66,37 +66,35 @@

    A ggproto for drawing start points

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    end_size
    +
    end_size

    numeric; the size of the end point

    -
    end_alpha
    +
    end_alpha

    numeric; the alpha of the end point

    -
    end_color
    +
    end_color

    the variable to be coloured by

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for drawing end points in explore_space_pca()

    - - +

    a wrapper for drawing end points in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anchor(), add_anno(), add_dir_search(), @@ -121,15 +119,15 @@

    See also

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/add_interp.html b/docs/reference/add_interp.html index 35ca24b..77fbf2e 100644 --- a/docs/reference/add_interp.html +++ b/docs/reference/add_interp.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -73,41 +73,39 @@

    A ggproto for drawing interpolation path

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    interp_size
    +
    interp_size

    numeric; the size of the interpolation path

    -
    interp_alpha
    +
    interp_alpha

    numeric; the alpha of the interpolation path

    -
    interp_color
    +
    interp_color

    the variable to be coloured by

    -
    interp_group
    +
    interp_group

    the variable to label different interpolation path

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for drawing the interpolation points in explore_space_pca()

    - - +

    a wrapper for drawing the interpolation points in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anchor(), add_anno(), add_dir_search(), @@ -132,15 +130,15 @@

    See also

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/add_interp_last.html b/docs/reference/add_interp_last.html index 581cd80..9d015b8 100644 --- a/docs/reference/add_interp_last.html +++ b/docs/reference/add_interp_last.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -72,37 +72,35 @@

    A ggproto for drawing finish points

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    interp_last_size
    +
    interp_last_size

    numeric; the size of the last interpolation points in each iteration

    -
    interp_last_alpha
    +
    interp_last_alpha

    numeric; the alpha of the last interpolation points in each iteration

    -
    interp_last_color
    +
    interp_last_color

    the variable to be coloured by

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for drawing the last interpolation points of each iteration in explore_space_pca()

    - - +

    a wrapper for drawing the last interpolation points of each iteration in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anchor(), add_anno(), add_dir_search(), @@ -127,15 +125,15 @@

    See also

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/add_interrupt.html b/docs/reference/add_interrupt.html index 5965f6e..2d95629 100644 --- a/docs/reference/add_interrupt.html +++ b/docs/reference/add_interrupt.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -74,45 +74,43 @@

    A ggproto for annotating the interrupted path

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    interrupt_size
    +
    interrupt_size

    numeric; the size of the interruption path

    -
    interrupt_alpha
    +
    interrupt_alpha

    numeric; the alpha of the interruption path

    -
    interrupt_color
    +
    interrupt_color

    the variable to be coloured by

    -
    interrupt_group
    +
    interrupt_group

    the variable to label different interruption

    -
    interrupt_linetype
    +
    interrupt_linetype

    character; the linetype to annotate the interruption

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for annotating the interruption in explore_space_pca()

    - - +

    a wrapper for annotating the interruption in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anchor(), add_anno(), add_dir_search(), @@ -137,15 +135,15 @@

    See also

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/add_search.html b/docs/reference/add_search.html index 2ee6af5..728e1ed 100644 --- a/docs/reference/add_search.html +++ b/docs/reference/add_search.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -66,37 +66,35 @@

    A ggproto for drawing search points

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    search_size
    +
    search_size

    numeric; the size of the search points

    -
    search_alpha
    +
    search_alpha

    numeric; the alpha of the anchor points

    -
    search_color
    +
    search_color

    the variable to be coloured by

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for drawing search points in explore_space_pca()

    - - +

    a wrapper for drawing search points in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anchor(), add_anno(), add_dir_search(), @@ -121,15 +119,15 @@

    See also

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/add_space.html b/docs/reference/add_space.html index e0fb09c..388964c 100644 --- a/docs/reference/add_space.html +++ b/docs/reference/add_space.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -75,49 +75,47 @@

    A ggproto for drawing circle

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    space_alpha
    +
    space_alpha

    numeric; the alpha of the basis space

    -
    space_fill
    +
    space_fill

    character; the colour of the space filling

    -
    space_color
    +
    space_color

    character; the colour of the space brim

    -
    cent_size
    +
    cent_size

    numeric; the size of the centre point

    -
    cent_alpha
    +
    cent_alpha

    numeric; an alpha of the centre point

    -
    cent_color
    +
    cent_color

    character; the colour of the centre point

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for drawing the space in explore_space_pca()

    - - +

    a wrapper for drawing the space in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anchor(), add_anno(), add_dir_search(), @@ -133,7 +131,6 @@

    See also

    Examples

    library(ggplot2)
    -#> Warning: package ‘ggplot2’ was built under R version 4.3.2
     space <- tibble::tibble(x0 = 0, y0 = 0, r = 5)
     ggplot() +
       add_space(space) +
    @@ -154,15 +151,15 @@ 

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/add_start.html b/docs/reference/add_start.html index 08db7c1..2113215 100644 --- a/docs/reference/add_start.html +++ b/docs/reference/add_start.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -66,37 +66,35 @@

    A ggproto for drawing start points

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    start_size
    +
    start_size

    numeric; the size of start point

    -
    start_alpha
    +
    start_alpha

    numeric; the alpha of start point

    -
    start_color
    +
    start_color

    the variable to be coloured by

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for drawing start points in explore_space_pca()

    - - +

    a wrapper for drawing start points in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anchor(), add_anno(), add_dir_search(), @@ -114,17 +112,16 @@

    Examples

    library(ggplot2)
     # construct the space and start df for plotting
     space <- tibble::tibble(x0 = 0, y0 = 0, r = 5)
    -start <- holes_1d_geo %>%
    +holes_1d_geo %>%
       compute_pca() %>%
       purrr::pluck("aug") %>%
       clean_method() %>%
       get_start()
    -ggplot() +
    -  add_space(dt = space) +
    -  add_start(dt = start, start_color = info) +
    -  theme_void() +
    -  theme(aspect.ratio = 1)
    -
    +#> # A tibble: 1 × 14
    +#>   basis    index_val info    method alpha tries  loop    id row_num   PC1    PC2
    +#>   <list>       <dbl> <chr>   <chr>  <dbl> <dbl> <dbl> <dbl>   <int> <dbl>  <dbl>
    +#> 1 <dbl[…]>     0.749 new_ba… PD       0.5     1     1     1       1 -1.87 -0.505
    +#> # ℹ 3 more variables: PC3 <dbl>, PC4 <dbl>, PC5 <dbl>
     
    @@ -139,15 +136,15 @@

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/add_theo.html b/docs/reference/add_theo.html index 4596297..44dba30 100644 --- a/docs/reference/add_theo.html +++ b/docs/reference/add_theo.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -73,41 +73,39 @@

    A ggproto for drawing the theoretical basis, if applicable

    Arguments

    -
    dt
    + + +
    dt

    A data object from the running the optimisation algorithm in guided tour

    -
    theo_label
    +
    theo_label

    character; a symbol to label the theoretical point

    -
    theo_size
    +
    theo_size

    numeric; the size of the theoretical point

    -
    theo_alpha
    +
    theo_alpha

    numeric; the alpha of the theoretical point

    -
    theo_color
    +
    theo_color

    character; the colour of the theoretical point in hex

    -
    ...
    +
    ...

    other aesthetics inherent from explore_space_pca()

    Value

    - - -

    a wrapper for drawing theoretical points in explore_space_pca()

    - - +

    a wrapper for drawing theoretical points in explore_space_pca()

    See also

    -

    Other draw functions: +

    Other draw functions: add_anchor(), add_anno(), add_dir_search(), @@ -132,15 +130,15 @@

    See also

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/bind_random.html b/docs/reference/bind_random.html index 6319b39..41e0185 100644 --- a/docs/reference/bind_random.html +++ b/docs/reference/bind_random.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -66,27 +66,27 @@

    Bind random bases in the projection bases space

    Arguments

    -
    dt
    + + +
    dt

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    n
    +
    n

    numeric; the number of random bases to generate in each dimension by geozoo

    -
    seed
    +
    seed

    numeric; a seed for generating reproducible random bases from geozoo

    Value

    - - -

    a tibble object containing both the searched and random bases

    +

    a tibble object containing both the searched and random bases

    See also

    -

    Other bind: +

    @@ -116,15 +116,15 @@

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/bind_random_matrix.html b/docs/reference/bind_random_matrix.html index 84c491a..1775b04 100644 --- a/docs/reference/bind_random_matrix.html +++ b/docs/reference/bind_random_matrix.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -64,38 +64,36 @@

    Bind random bases in the projection bases space as a matrix

    Arguments

    -
    basis
    + + +
    basis

    a matrix returned by get_basis_matrix()

    -
    n
    +
    n

    numeric; the number of random bases to generate in each dimension by geozoo

    -
    d
    +
    d

    numeric; dimension of the basis, d = 1, 2, ...

    -
    front
    +
    front

    logical; if the random bases should be bound before or after the original bases

    -
    seed
    +
    seed

    numeric; a seed for generating reproducible random bases from geozoo

    Value

    - - -

    matrix

    - - +

    matrix

    a matrix containing both the searched and random bases

    See also

    -

    Other bind: +

    Other bind: bind_random(), bind_theoretical()

    @@ -124,15 +122,15 @@

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/bind_theoretical.html b/docs/reference/bind_theoretical.html index e2a27dc..42e7cb7 100644 --- a/docs/reference/bind_theoretical.html +++ b/docs/reference/bind_theoretical.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -66,31 +66,31 @@

    Bind the theoretical best record

    Arguments

    -
    dt
    + + +
    dt

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    matrix
    +
    matrix

    a matrix of the theoretical basis

    -
    index
    +
    index

    the index function used to calculate the index value

    -
    raw_data
    +
    raw_data

    a tibble of the original data used to calculate the index value

    Value

    - - -

    a tibble object containing both the searched and theoretical best bases

    +

    a tibble object containing both the searched and theoretical best bases

    See also

    -

    Other bind: +

    @@ -98,7 +98,7 @@

    See also

    Examples

    best <- matrix(c(0, 1, 0, 0, 0), nrow = 5)
    -tail(holes_1d_better %>% bind_theoretical(best, tourr::holes(), raw_data = boa5), 1)
    +tail(holes_1d_better %>% bind_theoretical(best, tourr::holes(), raw_data = boa5), 1)
     #> # A tibble: 1 × 8
     #>   basis         index_val info        method alpha tries  loop    id
     #>   <list>            <dbl> <chr>       <chr>  <dbl> <dbl> <dbl> <dbl>
    @@ -117,15 +117,15 @@ 

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/color.html b/docs/reference/color.html index 01d37a2..6c8cd32 100644 --- a/docs/reference/color.html +++ b/docs/reference/color.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -70,19 +70,19 @@

    Format

    Arguments

    -
    palette
    + + +
    palette

    Colour palette from the botanical_palette

    -
    reverse
    +
    reverse

    logical, if the colour should be reversed

    Value

    - - -

    a function for interpolating colour in the botanical palette

    +

    a function for interpolating colour in the botanical palette

    @@ -97,15 +97,15 @@

    Value

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/data.html b/docs/reference/data.html index 8750a5a..b640c76 100644 --- a/docs/reference/data.html +++ b/docs/reference/data.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -109,15 +109,15 @@

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/explore_space_pca.html b/docs/reference/explore_space_pca.html index 74db72b..16458f8 100644 --- a/docs/reference/explore_space_pca.html +++ b/docs/reference/explore_space_pca.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -77,47 +77,47 @@

    Plot the PCA projection of the projection bases space

    Arguments

    -
    dt
    + + +
    dt

    a data object collected by the projection pursuit guided tour optimisation in tourr

    -
    group
    +
    group

    the variable to label different runs of the optimiser(s)

    -
    pca
    +
    pca

    logical; if PCA coordinates need to be computed for the data

    -
    ...
    +
    ...

    other arguments passed to add_*() functions

    -
    details
    +
    details

    logical; if components other than start, end and interpolation need to be shown

    -
    color
    +
    color

    the variable to be coloured by

    -
    facet
    +
    facet

    the variable to be faceted by

    -
    animate
    +
    animate

    logical; if the interpolation path needs to be animated

    Value

    - - -

    a ggplot2 object

    +

    a ggplot2 object

    See also

    -

    Other main plot functions: +

    @@ -127,7 +127,7 @@

    See also

    Examples

    dplyr::bind_rows(holes_1d_geo, holes_1d_better) %>%
       bind_theoretical(matrix(c(0, 1, 0, 0, 0), nrow = 5),
    -    index = tourr::holes(), raw_data = boa5
    +    index = tourr::holes(), raw_data = boa5
       ) %>%
       explore_space_pca(group = method, details = TRUE) +
       scale_color_discrete_botanical()
    @@ -135,46 +135,16 @@ 

    Examples

    #> Adding missing grouping variables: `method` +if (FALSE) { # \dontrun{ best <- matrix(c(0, 1, 0, 0, 0), nrow = 5) -dt <- bind_theoretical(holes_1d_jellyfish, best, tourr::holes(), raw_data = boa5) +dt <- bind_theoretical(holes_1d_jellyfish, best, tourr::holes(), raw_data = boa5) explore_space_start(dt) - explore_space_end(dt, group = loop, theo_size = 10, theo_color = "#FF0000") -#> signs in all the bases will be flipped in group 7 -#> signs in all the bases will be flipped in group 33 -#> signs in all the bases will be flipped in group 11 -#> signs in all the bases will be flipped in group 29 -#> signs in all the bases will be flipped in group 44 -#> signs in all the bases will be flipped in group 47 -#> signs in all the bases will be flipped in group 34 -#> signs in all the bases will be flipped in group 41 -#> signs in all the bases will be flipped in group 42 -#> signs in all the bases will be flipped in group 45 -#> signs in all the bases will be flipped in group 49 -#> signs in all the bases will be flipped in group 3 -#> signs in all the bases will be flipped in group 4 -#> signs in all the bases will be flipped in group 10 -#> signs in all the bases will be flipped in group 12 -#> signs in all the bases will be flipped in group 13 -#> signs in all the bases will be flipped in group 17 -#> signs in all the bases will be flipped in group 21 -#> signs in all the bases will be flipped in group 22 -#> signs in all the bases will be flipped in group 24 -#> signs in all the bases will be flipped in group 25 -#> signs in all the bases will be flipped in group 27 -#> signs in all the bases will be flipped in group 28 -#> signs in all the bases will be flipped in group 32 -#> signs in all the bases will be flipped in group 38 -#> signs in all the bases will be flipped in group 43 -#> signs in all the bases will be flipped in group 46 -#> signs in all the bases will be flipped in group 48 -#> signs in all the bases will be flipped in group 50 - explore_space_pca( dt, facet = loop, interp_size = 0.5, theo_size = 10, start_size = 1, end_size = 3 ) - +} # }
    @@ -189,15 +159,15 @@

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/explore_space_tour-1.png b/docs/reference/explore_space_tour-1.png index 287a8fa..ffd3177 100644 Binary files a/docs/reference/explore_space_tour-1.png and b/docs/reference/explore_space_tour-1.png differ diff --git a/docs/reference/explore_space_tour.html b/docs/reference/explore_space_tour.html index fc99534..4daa712 100644 --- a/docs/reference/explore_space_tour.html +++ b/docs/reference/explore_space_tour.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -81,69 +81,70 @@

    Plot the grand tour animation of the bases space in high dimension

    Arguments

    -
    ...
    -

    other argument passed to tourr::animate_xy() and prep_space_tour()

    -
    axes
    +
    ...
    +

    other argument passed to tourr::animate_xy() and prep_space_tour()

    + + +
    axes

    see [tourr::animate_xy()]

    -
    dt
    +
    dt

    a data object collected by the projection pursuit guided tour optimisation in tourr

    -
    group
    +
    group

    the variable to label different runs of the optimiser(s)

    -
    flip
    +
    flip

    logical; if the sign flipping need to be performed

    -
    n_random
    +
    n_random

    numeric; the number of random basis to generate

    -
    color
    +
    color

    the variable to be coloured by

    -
    rand_size
    +
    rand_size

    numeric; the size of random points

    -
    rand_color
    +
    rand_color

    character; the color hex code for random points

    -
    point_size
    +
    point_size

    numeric; the size of points searched by the optimiser(s)

    -
    end_size
    +
    end_size

    numeric; the size of end points

    -
    theo_size
    +
    theo_size

    numeric; the size of theoretical point(s)

    -
    theo_shape
    +
    theo_shape

    numeric; the shape symbol in the basic plot

    -
    theo_color
    +
    theo_color

    character; the color of theoretical point(s)

    -
    palette
    +
    palette

    the colour palette to be used

    Value

    -
    explore_space_tour()

    an animation of the search path in the high-dimensional sphere

    @@ -155,7 +156,7 @@

    Value

    See also

    -

    Other main plot functions: +

    @@ -169,6 +170,7 @@

    Examples

    #> map method to color #> Using half_range 1.1 +
    @@ -183,15 +185,15 @@

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/explore_trace.html b/docs/reference/explore_trace.html index 9b1695e..999dc7c 100644 --- a/docs/reference/explore_trace.html +++ b/docs/reference/explore_trace.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -74,51 +74,51 @@

    Plot the trace the search progression

    Arguments

    -
    dt
    + + +
    dt

    a data object collected by the projection pursuit guided tour optimisation in tourr

    -
    iter
    +
    iter

    the variable to be plotted on the x-axis

    -
    color
    +
    color

    the variable to be coloured by

    -
    group
    +
    group

    the variable to label different runs of the optimiser(s)

    -
    cutoff
    +
    cutoff

    numeric; if the number of interpolating points is smaller than cutoff, all the interpolation points will be plotted as dots

    -
    target_size
    +
    target_size

    numeric; the size of target points in the interpolation

    -
    interp_size
    +
    interp_size

    numeric; the size of interpolation points

    -
    accuracy_x
    +
    accuracy_x

    numeric; If the difference of two neighbour x-labels is smaller than accuracy_x, only one of them will be displayed. Used for better axis label

    -
    accuracy_y
    +
    accuracy_y

    numeric; the precision of y-axis label

    Value

    - - -

    a ggplot object for diagnosing how the index value progresses during the interpolation

    +

    a ggplot object for diagnosing how the index value progresses during the interpolation

    See also

    -

    Other main plot functions: +

    @@ -147,15 +147,15 @@

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/explore_trace_search.html b/docs/reference/explore_trace_search.html index fec7e8f..570cb56 100644 --- a/docs/reference/explore_trace_search.html +++ b/docs/reference/explore_trace_search.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -71,39 +71,39 @@

    Plot the count in each iteration

    Arguments

    -
    dt
    + + +
    dt

    a data object collected by the projection pursuit guided tour optimisation in tourr

    -
    iter
    +
    iter

    the variable to be plotted on the x-axis

    -
    color
    +
    color

    the variable to be coloured by

    -
    cutoff
    +
    cutoff

    numeric; if the number of searches in one iteration is smaller than cutoff, a point geom, rather than boxplot geom, will be used.

    -
    extend_lower
    +
    extend_lower

    a numeric for extending the y-axis to display text labels

    -
    ...
    +
    ...

    arguments passed into geom_label_repel() for displaying text labels

    Value

    - - -

    a ggplot object for diagnosing how many points the optimiser(s) have searched

    +

    a ggplot object for diagnosing how many points the optimiser(s) have searched

    See also

    -

    Other main plot functions: +

    @@ -155,15 +155,15 @@

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/ferrn-package.html b/docs/reference/ferrn-package.html index c71ff93..a381bfb 100644 --- a/docs/reference/ferrn-package.html +++ b/docs/reference/ferrn-package.html @@ -10,7 +10,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -38,14 +38,14 @@
    - +
    @@ -69,11 +69,11 @@

    See also

    Author

    -

    Maintainer: H. Sherry Zhang huize.zhang@monash.edu (ORCID)

    +

    Maintainer: H. Sherry Zhang huizezhangsh@gmail.com (ORCID)

    Authors:

    @@ -88,15 +88,15 @@

    Author

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/format_label.html b/docs/reference/format_label.html index 677255c..ed5a760 100644 --- a/docs/reference/format_label.html +++ b/docs/reference/format_label.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -64,19 +64,19 @@

    Better label formatting to avoid overlapping

    Arguments

    -
    labels
    + + +
    labels

    a numerical vector of labels

    -
    accuracy
    +
    accuracy

    the accuracy of the label

    Value

    - - -

    a vector of adjusted labels

    +

    a vector of adjusted labels

    @@ -99,15 +99,15 @@

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/get_anchor.html b/docs/reference/get_anchor.html index a080a4e..bde7d75 100644 --- a/docs/reference/get_anchor.html +++ b/docs/reference/get_anchor.html @@ -1,143 +1,8 @@ - -Extract the anchor points on the geodesic path — get_anchor • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    Extract the anchor points on the geodesic path

    -
    - -
    -
    get_anchor(dt, group = NULL)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    group
    -

    the variable to label different runs of the optimiser(s)

    -
    -
    -

    Value

    -

    a tibble object containing the target bases in each iteration

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    holes_1d_better %>% get_anchor()
    -#> # A tibble: 5 × 8
    -#>   basis         index_val info      method        alpha tries  loop    id
    -#>   <list>            <dbl> <chr>     <chr>         <dbl> <dbl> <dbl> <int>
    -#> 1 <dbl [5 × 1]>     0.749 new_basis search_better 0.5       1     1     1
    -#> 2 <dbl [5 × 1]>     0.752 new_basis search_better 0.5       2     6     2
    -#> 3 <dbl [5 × 1]>     0.798 new_basis search_better 0.495     3     1     3
    -#> 4 <dbl [5 × 1]>     0.813 new_basis search_better 0.49      4     7     4
    -#> 5 <dbl [5 × 1]>     0.904 new_basis search_better 0.485     5     3     5
    -holes_1d_geo %>% get_anchor()
    -#> # A tibble: 34 × 8
    -#>    basis         index_val info             method       alpha tries  loop    id
    -#>    <list>            <dbl> <chr>            <chr>        <dbl> <dbl> <dbl> <int>
    -#>  1 <dbl [5 × 1]>     0.749 new_basis        search_geod…   0.5     1     1     1
    -#>  2 <dbl [5 × 1]>     0.753 best_line_search search_geod…  NA       2     1     2
    -#>  3 <dbl [5 × 1]>     0.793 best_line_search search_geod…  NA       3     1     3
    -#>  4 <dbl [5 × 1]>     0.805 best_line_search search_geod…  NA       4     1     4
    -#>  5 <dbl [5 × 1]>     0.836 best_line_search search_geod…  NA       5     1     5
    -#>  6 <dbl [5 × 1]>     0.890 best_line_search search_geod…  NA       6     1     6
    -#>  7 <dbl [5 × 1]>     0.917 best_line_search search_geod…  NA       7     1     7
    -#>  8 <dbl [5 × 1]>     0.929 best_line_search search_geod…  NA       8     1     8
    -#>  9 <dbl [5 × 1]>     0.929 best_line_search search_geod…  NA       9     1     9
    -#> 10 <dbl [5 × 1]>     0.933 best_line_search search_geod…  NA       9     2    10
    -#> # … with 24 more rows
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/get_basis_matrix.html b/docs/reference/get_basis_matrix.html index 485fa12..bde7d75 100644 --- a/docs/reference/get_basis_matrix.html +++ b/docs/reference/get_basis_matrix.html @@ -1,124 +1,8 @@ - -Extract all the bases as a matrix — get_basis_matrix • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    Extract all the bases as a matrix

    -
    - -
    -
    get_basis_matrix(dt)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    -
    -

    Value

    -

    a matrix that flattens each basis into a row

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    head(get_basis_matrix(holes_1d_better), 5)
    -#>               V1         V2          V3        V4        V5
    -#> [1,]  0.34100587 -0.1129065 -0.14519958 0.0357833 0.9211969
    -#> [2,]  0.47021229  0.2323680  0.49786511 0.3133040 0.6155294
    -#> [3,] -0.07081708 -0.3776694 -0.10317006 0.3478981 0.8489250
    -#> [4,]  0.23230438 -0.2897560  0.18500055 0.5184984 0.7476699
    -#> [5,] -0.10216793  0.4893826 -0.08432954 0.1108271 0.8547937
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/get_dir_search.html b/docs/reference/get_dir_search.html index a3806e5..bde7d75 100644 --- a/docs/reference/get_dir_search.html +++ b/docs/reference/get_dir_search.html @@ -1,140 +1,8 @@ - -Extract directional search points during the optimisation — get_dir_search • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    Extract directional search points during the optimisation

    -
    - -
    -
    get_dir_search(dt, ratio = 5, ...)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    ratio
    -

    numeric; a buffer value to deviate directional search points from the anchor points

    -
    ...
    -

    arguments passed to compute_pca()

    -
    -
    -

    Value

    -

    a tibble object containing the directional search bases in pseudo derivative search

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    holes_1d_geo %>%
    -  compute_pca() %>%
    -  purrr::pluck("aug") %>%
    -  get_dir_search()
    -#> # A tibble: 330 × 16
    -#>    basis    index_val info   method alpha tries  loop    id row_num   PC1    PC2
    -#>    <list>       <dbl> <chr>  <chr>  <dbl> <dbl> <dbl> <dbl>   <int> <dbl>  <dbl>
    -#>  1 <dbl[…]>     0.749 direc… PD        NA     2     1     2       2 -1.80 -0.776
    -#>  2 <dbl[…]>     0.749 direc… PD        NA     2     1     3       3 -1.77 -0.601
    -#>  3 <dbl[…]>     0.749 direc… PD        NA     2     1     4       4 -1.79 -0.632
    -#>  4 <dbl[…]>     0.749 direc… PD        NA     2     1     5       5 -1.78 -0.745
    -#>  5 <dbl[…]>     0.749 direc… PD        NA     2     1     6       6 -1.80 -0.562
    -#>  6 <dbl[…]>     0.749 direc… PD        NA     2     1     7       7 -1.77 -0.815
    -#>  7 <dbl[…]>     0.749 direc… PD        NA     2     1     8       8 -1.73 -0.732
    -#>  8 <dbl[…]>     0.749 direc… PD        NA     2     1     9       9 -1.84 -0.644
    -#>  9 <dbl[…]>     0.749 best_… PD        NA     2     1    10      10 -1.78 -0.804
    -#> 10 <dbl[…]>     0.749 direc… PD        NA     2     1    11      11 -1.79 -0.573
    -#> # … with 320 more rows, and 5 more variables: PC3 <dbl>, PC4 <dbl>, PC5 <dbl>,
    -#> #   anchor_x <dbl>, anchor_y <dbl>
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/get_interp.html b/docs/reference/get_interp.html index 4db9489..bde7d75 100644 --- a/docs/reference/get_interp.html +++ b/docs/reference/get_interp.html @@ -1,141 +1,8 @@ - -Extract interpolated records — get_interp • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    Extract interpolated records

    -
    - -
    -
    get_interp(dt, group = NULL)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    group
    -

    the variable to label different runs of the optimiser(s)

    -
    -
    -

    Value

    -

    a tibble object containing the interpolating bases

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    holes_1d_better %>%
    -  get_interp() %>%
    -  head()
    -#> # A tibble: 6 × 8
    -#>   basis         index_val info          method        alpha tries  loop    id
    -#>   <list>            <dbl> <chr>         <chr>         <dbl> <dbl> <dbl> <int>
    -#> 1 <dbl [5 × 1]>     0.749 interpolation search_better    NA     2     1     1
    -#> 2 <dbl [5 × 1]>     0.750 interpolation search_better    NA     2     2     2
    -#> 3 <dbl [5 × 1]>     0.751 interpolation search_better    NA     2     3     3
    -#> 4 <dbl [5 × 1]>     0.751 interpolation search_better    NA     2     4     4
    -#> 5 <dbl [5 × 1]>     0.752 interpolation search_better    NA     2     5     5
    -#> 6 <dbl [5 × 1]>     0.752 interpolation search_better    NA     2     6     6
    -get_interp(dplyr::bind_rows(holes_1d_better, holes_1d_geo), group = method) %>% head()
    -#> # A tibble: 6 × 8
    -#>   basis         index_val info          method        alpha tries  loop    id
    -#>   <list>            <dbl> <chr>         <chr>         <dbl> <dbl> <dbl> <int>
    -#> 1 <dbl [5 × 1]>     0.749 interpolation search_better    NA     2     1     1
    -#> 2 <dbl [5 × 1]>     0.750 interpolation search_better    NA     2     2     2
    -#> 3 <dbl [5 × 1]>     0.751 interpolation search_better    NA     2     3     3
    -#> 4 <dbl [5 × 1]>     0.751 interpolation search_better    NA     2     4     4
    -#> 5 <dbl [5 × 1]>     0.752 interpolation search_better    NA     2     5     5
    -#> 6 <dbl [5 × 1]>     0.752 interpolation search_better    NA     2     6     6
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/get_interp_last.html b/docs/reference/get_interp_last.html index 1fc132c..bde7d75 100644 --- a/docs/reference/get_interp_last.html +++ b/docs/reference/get_interp_last.html @@ -1,143 +1,8 @@ - -Extract the end point at each interpolation — get_interp_last • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    Extract the end point at each interpolation

    -
    - -
    -
    get_interp_last(dt, group = NULL)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    group
    -

    the variable to label different runs of the optimiser(s)

    -
    -
    -

    Value

    -

    a tibble object containing the last interpolating basis in each iteration

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    holes_1d_better %>% get_interp_last()
    -#> # A tibble: 4 × 8
    -#>   basis         index_val info          method        alpha tries  loop    id
    -#>   <list>            <dbl> <chr>         <chr>         <dbl> <dbl> <dbl> <int>
    -#> 1 <dbl [5 × 1]>     0.753 interpolation search_better    NA     2     9     9
    -#> 2 <dbl [5 × 1]>     0.798 interpolation search_better    NA     3    15    24
    -#> 3 <dbl [5 × 1]>     0.866 interpolation search_better    NA     4     7    31
    -#> 4 <dbl [5 × 1]>     0.914 interpolation search_better    NA     5     6    37
    -get_interp_last(dplyr::bind_rows(holes_1d_better, holes_1d_geo), group = method)
    -#> # A tibble: 12 × 8
    -#>    basis         index_val info          method          alpha tries  loop    id
    -#>    <list>            <dbl> <chr>         <chr>           <dbl> <dbl> <dbl> <int>
    -#>  1 <dbl [5 × 1]>     0.753 interpolation search_better      NA     2     9     9
    -#>  2 <dbl [5 × 1]>     0.798 interpolation search_better      NA     3    15    24
    -#>  3 <dbl [5 × 1]>     0.866 interpolation search_better      NA     4     7    31
    -#>  4 <dbl [5 × 1]>     0.914 interpolation search_better      NA     5     6    37
    -#>  5 <dbl [5 × 1]>     0.753 interpolation search_geodesic    NA     2     7     7
    -#>  6 <dbl [5 × 1]>     0.793 interpolation search_geodesic    NA     3    11    18
    -#>  7 <dbl [5 × 1]>     0.805 interpolation search_geodesic    NA     4     7    25
    -#>  8 <dbl [5 × 1]>     0.836 interpolation search_geodesic    NA     5     8    33
    -#>  9 <dbl [5 × 1]>     0.890 interpolation search_geodesic    NA     6     7    40
    -#> 10 <dbl [5 × 1]>     0.917 interpolation search_geodesic    NA     7     5    45
    -#> 11 <dbl [5 × 1]>     0.929 interpolation search_geodesic    NA     8     4    49
    -#> 12 <dbl [5 × 1]>     0.933 interpolation search_geodesic    NA     9     3    52
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/get_interrupt.html b/docs/reference/get_interrupt.html index 4bf3332..bde7d75 100644 --- a/docs/reference/get_interrupt.html +++ b/docs/reference/get_interrupt.html @@ -1,138 +1,8 @@ - -Extract the end point of the interpolation and the target point in the iteration when an interruption happens — get_interrupt • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    The optimiser can find better basis on the interpolation path, an interruption is -implemented to stop further interpolation from the highest point to the target point. -This discrepancy is highlighted in the PCA plot. You should not use geodesic search on this function.

    -
    - -
    -
    get_interrupt(dt, group = NULL, precision = 0.001)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    group
    -

    the variable to label different runs of the optimiser(s)

    -
    precision
    -

    numeric; if the index value of the last interpolating point and the anchor point differ by precision, an interruption is registered

    -
    -
    -

    Value

    -

    a tibble object containing the target and anchor bases for the iteration when an interruption happens

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    holes_1d_better %>% get_interrupt()
    -#> # A tibble: 6 × 8
    -#>   basis         index_val info          method         alpha tries  loop id   
    -#>   <list>            <dbl> <chr>         <chr>          <dbl> <dbl> <dbl> <chr>
    -#> 1 <dbl [5 × 1]>     0.752 new_basis     search_better  0.5       2     6 2    
    -#> 2 <dbl [5 × 1]>     0.813 new_basis     search_better  0.49      4     7 4    
    -#> 3 <dbl [5 × 1]>     0.904 new_basis     search_better  0.485     5     3 5    
    -#> 4 <dbl [5 × 1]>     0.753 interpolation search_better NA         2     9 2    
    -#> 5 <dbl [5 × 1]>     0.866 interpolation search_better NA         4     7 4    
    -#> 6 <dbl [5 × 1]>     0.914 interpolation search_better NA         5     6 5    
    -holes_1d_geo %>% get_interrupt()
    -#> interrupt is only implemented for creeping random search (search_better) and simulated annealing (search_better_random)
    -#> NULL
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/get_search.html b/docs/reference/get_search.html index 9c18824..bde7d75 100644 --- a/docs/reference/get_search.html +++ b/docs/reference/get_search.html @@ -1,147 +1,8 @@ - -Extract search points during the optimisation — get_search • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    Extract search points during the optimisation

    -
    - -
    -
    get_search(dt)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    -
    -

    Value

    -

    a tibble object containing the search bases

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    holes_1d_better %>% get_search()
    -#> # A tibble: 37 × 8
    -#>    basis         index_val info          method        alpha tries  loop    id
    -#>    <list>            <dbl> <chr>         <chr>         <dbl> <dbl> <dbl> <int>
    -#>  1 <dbl [5 × 1]>     0.730 random_search search_better  0.5      2     1     2
    -#>  2 <dbl [5 × 1]>     0.743 random_search search_better  0.5      2     2     3
    -#>  3 <dbl [5 × 1]>     0.736 random_search search_better  0.5      2     3     4
    -#>  4 <dbl [5 × 1]>     0.747 random_search search_better  0.5      2     4     5
    -#>  5 <dbl [5 × 1]>     0.725 random_search search_better  0.5      2     5     6
    -#>  6 <dbl [5 × 1]>     0.769 random_search search_better  0.49     4     1    33
    -#>  7 <dbl [5 × 1]>     0.754 random_search search_better  0.49     4     2    34
    -#>  8 <dbl [5 × 1]>     0.725 random_search search_better  0.49     4     3    35
    -#>  9 <dbl [5 × 1]>     0.766 random_search search_better  0.49     4     4    36
    -#> 10 <dbl [5 × 1]>     0.736 random_search search_better  0.49     4     5    37
    -#> # … with 27 more rows
    -holes_1d_geo %>% get_search()
    -#> # A tibble: 363 × 8
    -#>    basis         index_val info                  method  alpha tries  loop    id
    -#>    <list>            <dbl> <chr>                 <chr>   <dbl> <dbl> <dbl> <int>
    -#>  1 <dbl [5 × 1]>     0.749 direction_search      search…    NA     2     1     2
    -#>  2 <dbl [5 × 1]>     0.749 direction_search      search…    NA     2     1     3
    -#>  3 <dbl [5 × 1]>     0.749 direction_search      search…    NA     2     1     4
    -#>  4 <dbl [5 × 1]>     0.749 direction_search      search…    NA     2     1     5
    -#>  5 <dbl [5 × 1]>     0.749 direction_search      search…    NA     2     1     6
    -#>  6 <dbl [5 × 1]>     0.749 direction_search      search…    NA     2     1     7
    -#>  7 <dbl [5 × 1]>     0.749 direction_search      search…    NA     2     1     8
    -#>  8 <dbl [5 × 1]>     0.749 direction_search      search…    NA     2     1     9
    -#>  9 <dbl [5 × 1]>     0.749 best_direction_search search…    NA     2     1    10
    -#> 10 <dbl [5 × 1]>     0.749 direction_search      search…    NA     2     1    11
    -#> # … with 353 more rows
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/get_search_count.html b/docs/reference/get_search_count.html index 05c5f3b..bde7d75 100644 --- a/docs/reference/get_search_count.html +++ b/docs/reference/get_search_count.html @@ -1,154 +1,8 @@ - -Extract the count in each iteration — get_search_count • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    Extract the count in each iteration

    -
    - -
    -
    get_search_count(dt, iter = NULL, group = NULL)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    iter
    -

    the variable to be counted by

    -
    group
    -

    the variable to label different runs of the optimiser(s)

    -
    -
    -

    Value

    -

    a tibble object of the number of searches conducted by the optimiser(s) in each iteration

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    get_search_count(holes_1d_better)
    -#> map tries to the x-axis
    -#> # A tibble: 6 × 2
    -#>   tries     n
    -#>   <dbl> <int>
    -#> 1     1     1
    -#> 2     2     6
    -#> 3     3     1
    -#> 4     4     7
    -#> 5     5     3
    -#> 6     6    24
    -get_search_count(dplyr::bind_rows(holes_1d_better, holes_1d_geo), group = method)
    -#> map tries to the x-axis
    -#> # A tibble: 16 × 3
    -#> # Groups:   tries [10]
    -#>    tries method              n
    -#>    <dbl> <chr>           <int>
    -#>  1     1 search_better       1
    -#>  2     2 search_better       6
    -#>  3     3 search_better       1
    -#>  4     4 search_better       7
    -#>  5     5 search_better       3
    -#>  6     6 search_better      24
    -#>  7     1 search_geodesic     1
    -#>  8     2 search_geodesic    11
    -#>  9     3 search_geodesic    11
    -#> 10     4 search_geodesic    11
    -#> 11     5 search_geodesic    11
    -#> 12     6 search_geodesic    11
    -#> 13     7 search_geodesic    11
    -#> 14     8 search_geodesic    11
    -#> 15     9 search_geodesic    22
    -#> 16    10 search_geodesic   264
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/get_space_param.html b/docs/reference/get_space_param.html index 47dbd25..bde7d75 100644 --- a/docs/reference/get_space_param.html +++ b/docs/reference/get_space_param.html @@ -1,122 +1,8 @@ - -Estimate the radius of the background circle based on the randomly generated points — get_space_param • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    The space of projected bases is a circle when reduced to 2D. A radius is estimated using -the largest distance from the bases in the data object to the centre point.

    -
    - -
    -
    get_space_param(dt, ...)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    ...
    -

    other arguments passed to compute_pca()

    -
    -
    -

    Value

    -

    a tibble object of the centre and radius of the basis space

    -
    -
    -

    Details

    -

    This is a wrapper function used by explore_space_pca() and -should be be called directly by the user

    -
    -
    -

    See also

    - -
    - -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/get_start.html b/docs/reference/get_start.html index 7fcc011..bde7d75 100644 --- a/docs/reference/get_start.html +++ b/docs/reference/get_start.html @@ -1,122 +1,8 @@ - -Extract the starting records — get_start • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    Extract the starting records

    -
    - -
    -
    get_start(dt)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    -
    -

    Value

    -

    a tibble object containing the start basis

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    holes_1d_better %>% get_start()
    -#> # A tibble: 1 × 8
    -#>   basis         index_val info      method        alpha tries  loop    id
    -#>   <list>            <dbl> <chr>     <chr>         <dbl> <dbl> <dbl> <int>
    -#> 1 <dbl [5 × 1]>     0.749 new_basis search_better   0.5     1     1     1
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/get_theo.html b/docs/reference/get_theo.html index 8cb73ce..bde7d75 100644 --- a/docs/reference/get_theo.html +++ b/docs/reference/get_theo.html @@ -1,125 +1,8 @@ - -Extract the theoretical best basis, if applicable — get_theo • ferrn - - -
    -
    - - - -
    -
    - - -
    -

    Extract the theoretical best basis, if applicable

    -
    - -
    -
    get_theo(dt)
    -
    - -
    -

    Arguments

    -
    dt
    -

    a data object collected by the projection pursuit guided tour optimisation in the tourr package

    -
    -
    -

    Value

    -

    a tibble object containing the theoretical bases

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    best <- matrix(c(0, 1, 0, 0, 0), nrow = 5)
    -holes_1d_better %>%
    -  bind_theoretical(best, tourr::holes(), raw_data = boa5) %>%
    -  get_theo()
    -#> # A tibble: 1 × 8
    -#>   basis         index_val info        method alpha tries  loop    id
    -#>   <list>            <dbl> <chr>       <chr>  <dbl> <dbl> <dbl> <dbl>
    -#> 1 <dbl [5 × 1]>     0.931 theoretical NA        NA    NA    NA     0
    -
    -
    -
    - -
    - - -
    - -
    -

    Site built with pkgdown 2.0.3.

    -
    - -
    - - - - - - - + + + + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 5eb11bf..7036edf 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,5 +1,5 @@ -Function reference • ferrnPackage index • ferrn - +
    @@ -37,14 +37,14 @@
    - +
    @@ -80,6 +80,10 @@

    Main plotting functions flip_sign() compute_pca()

    Helper functions for `explore_space_pca()`

    + +

    geom_huber() prep_huber() theme_huber()

    + +

    Create Huber plot with ggplot2

    Get components

    Extracting components from existing data object

    @@ -213,15 +217,15 @@

    Miscellaneous
    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/pipe.html b/docs/reference/pipe.html index 7446783..e5fcf1c 100644 --- a/docs/reference/pipe.html +++ b/docs/reference/pipe.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -64,9 +64,7 @@

    Pipe operator

    Value

    - - -

    this is a magrittr pipe!

    +

    this is a magrittr pipe!

    @@ -81,15 +79,15 @@

    Value

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/relevel.html b/docs/reference/relevel.html index dc5092e..4cf1fc5 100644 --- a/docs/reference/relevel.html +++ b/docs/reference/relevel.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -64,15 +64,15 @@

    Clean method names

    Arguments

    -
    dt
    + + +
    dt

    a data object

    Value

    - - -

    a tibble with method cleaned

    +

    a tibble with method cleaned

    @@ -100,15 +100,15 @@

    Examples

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/scale.html b/docs/reference/scale.html index 987b280..8da27d2 100644 --- a/docs/reference/scale.html +++ b/docs/reference/scale.html @@ -12,7 +12,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -40,14 +40,14 @@
    - +
    @@ -76,31 +76,25 @@

    continuous scale colour function

    Arguments

    -
    palette
    + + +
    palette

    colour palette from the botanical_palette

    -
    reverse
    +
    reverse

    logical; if the colour should be reversed

    -
    ...
    +
    ...

    other arguments passed into scale_color_gradientn

    Value

    - - -

    a wrapper for continuous scales in the botanical palette

    - - +

    a wrapper for continuous scales in the botanical palette

    a wrapper for discrete scales in the botanical palette

    - -

    a wrapper for continuous fill in the botanical palette

    - -

    a wrapper for discrete fill in the botanical palette

    @@ -116,15 +110,15 @@

    Value

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/reference/theme_fern.html b/docs/reference/theme_fern.html index 3754d18..674607c 100644 --- a/docs/reference/theme_fern.html +++ b/docs/reference/theme_fern.html @@ -9,7 +9,7 @@ gtag('config', 'G-SPC6B94B10'); - +
    @@ -37,14 +37,14 @@
    - +
    @@ -64,11 +64,7 @@

    A specific theme for trace plots

    Value

    - - -

    a ggplot2 theme for explore_trace_interp()

    - - +

    a ggplot2 theme for explore_trace_interp()

    @@ -83,15 +79,15 @@

    Value

    -

    Site built with pkgdown 2.0.8.

    +

    Site built with pkgdown 2.1.0.

    - - + + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 1e56007..967ec34 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -1,153 +1,43 @@ - - - - https://huizezhang-sherry.github.io/ferrn/404.html - - - https://huizezhang-sherry.github.io/ferrn/LICENSE-text.html - - - https://huizezhang-sherry.github.io/ferrn/LICENSE.html - - - https://huizezhang-sherry.github.io/ferrn/authors.html - - - https://huizezhang-sherry.github.io/ferrn/index.html - - - https://huizezhang-sherry.github.io/ferrn/news/index.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_anchor.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_anno.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_dir_search.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_end.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_interp.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_interp_last.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_interrupt.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_search.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_space.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_start.html - - - https://huizezhang-sherry.github.io/ferrn/reference/add_theo.html - - - https://huizezhang-sherry.github.io/ferrn/reference/bind_random.html - - - https://huizezhang-sherry.github.io/ferrn/reference/bind_random_matrix.html - - - https://huizezhang-sherry.github.io/ferrn/reference/bind_theoretical.html - - - https://huizezhang-sherry.github.io/ferrn/reference/color.html - - - https://huizezhang-sherry.github.io/ferrn/reference/data.html - - - https://huizezhang-sherry.github.io/ferrn/reference/explore_space_pca.html - - - https://huizezhang-sherry.github.io/ferrn/reference/explore_space_tour.html - - - https://huizezhang-sherry.github.io/ferrn/reference/explore_trace.html - - - https://huizezhang-sherry.github.io/ferrn/reference/explore_trace_search.html - - - https://huizezhang-sherry.github.io/ferrn/reference/ferrn-package.html - - - https://huizezhang-sherry.github.io/ferrn/reference/format_label.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_anchor.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_basis_matrix.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_best.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_dir_search.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_interp.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_interp_last.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_interrupt.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_search.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_search_count.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_space_param.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_start.html - - - https://huizezhang-sherry.github.io/ferrn/reference/get_theo.html - - - https://huizezhang-sherry.github.io/ferrn/reference/index.html - - - https://huizezhang-sherry.github.io/ferrn/reference/optim.html - - - https://huizezhang-sherry.github.io/ferrn/reference/pca-helper.html - - - https://huizezhang-sherry.github.io/ferrn/reference/pipe-sine-boa.html - - - https://huizezhang-sherry.github.io/ferrn/reference/pipe.html - - - https://huizezhang-sherry.github.io/ferrn/reference/projection.html - - - https://huizezhang-sherry.github.io/ferrn/reference/relevel.html - - - https://huizezhang-sherry.github.io/ferrn/reference/scale.html - - - https://huizezhang-sherry.github.io/ferrn/reference/theme_fern.html - + +https://huizezhang-sherry.github.io/ferrn/404.html +https://huizezhang-sherry.github.io/ferrn/LICENSE-text.html +https://huizezhang-sherry.github.io/ferrn/LICENSE.html +https://huizezhang-sherry.github.io/ferrn/authors.html +https://huizezhang-sherry.github.io/ferrn/index.html +https://huizezhang-sherry.github.io/ferrn/news/index.html +https://huizezhang-sherry.github.io/ferrn/reference/add_anchor.html +https://huizezhang-sherry.github.io/ferrn/reference/add_anno.html +https://huizezhang-sherry.github.io/ferrn/reference/add_dir_search.html +https://huizezhang-sherry.github.io/ferrn/reference/add_end.html +https://huizezhang-sherry.github.io/ferrn/reference/add_interp.html +https://huizezhang-sherry.github.io/ferrn/reference/add_interp_last.html +https://huizezhang-sherry.github.io/ferrn/reference/add_interrupt.html +https://huizezhang-sherry.github.io/ferrn/reference/add_search.html +https://huizezhang-sherry.github.io/ferrn/reference/add_space.html +https://huizezhang-sherry.github.io/ferrn/reference/add_start.html +https://huizezhang-sherry.github.io/ferrn/reference/add_theo.html +https://huizezhang-sherry.github.io/ferrn/reference/bind_random.html +https://huizezhang-sherry.github.io/ferrn/reference/bind_random_matrix.html +https://huizezhang-sherry.github.io/ferrn/reference/bind_theoretical.html +https://huizezhang-sherry.github.io/ferrn/reference/color.html +https://huizezhang-sherry.github.io/ferrn/reference/data.html +https://huizezhang-sherry.github.io/ferrn/reference/explore_space_pca.html +https://huizezhang-sherry.github.io/ferrn/reference/explore_space_tour.html +https://huizezhang-sherry.github.io/ferrn/reference/explore_trace.html +https://huizezhang-sherry.github.io/ferrn/reference/explore_trace_search.html +https://huizezhang-sherry.github.io/ferrn/reference/ferrn-package.html +https://huizezhang-sherry.github.io/ferrn/reference/format_label.html +https://huizezhang-sherry.github.io/ferrn/reference/get.html +https://huizezhang-sherry.github.io/ferrn/reference/get_best.html +https://huizezhang-sherry.github.io/ferrn/reference/huber.html +https://huizezhang-sherry.github.io/ferrn/reference/index.html +https://huizezhang-sherry.github.io/ferrn/reference/optim.html +https://huizezhang-sherry.github.io/ferrn/reference/pca-helper.html +https://huizezhang-sherry.github.io/ferrn/reference/pipe-sine-boa.html +https://huizezhang-sherry.github.io/ferrn/reference/pipe.html +https://huizezhang-sherry.github.io/ferrn/reference/projection.html +https://huizezhang-sherry.github.io/ferrn/reference/relevel.html +https://huizezhang-sherry.github.io/ferrn/reference/scale.html +https://huizezhang-sherry.github.io/ferrn/reference/theme_fern.html + diff --git a/man/huber.Rd b/man/huber.Rd index 443985f..31eafd8 100644 --- a/man/huber.Rd +++ b/man/huber.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/huber-plot.R \name{geom_huber} \alias{geom_huber} +\alias{prep_huber} \alias{theme_huber} \title{Create Huber plot with ggplot2} \usage{ @@ -11,11 +12,12 @@ geom_huber( stat = "identity", position = "identity", ..., - index = NULL, show.legend = NA, inherit.aes = TRUE ) +prep_huber(data, index) + theme_huber(...) } \arguments{ @@ -93,8 +95,6 @@ lists which parameters it can accept. \link[ggplot2:draw_key]{key glyphs}, to change the display of the layer in the legend. }} -\item{index}{a function, the projection pursuit index function, see examples} - \item{show.legend}{logical. Should this layer be included in the legends? \code{NA}, the default, includes if any aesthetics are mapped. \code{FALSE} never includes, and \code{TRUE} always includes. @@ -105,7 +105,31 @@ display.} rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. \code{\link[ggplot2:borders]{borders()}}.} + +\item{index}{a function, the projection pursuit index function, see examples} } \description{ Create Huber plot with ggplot2 } +\examples{ +library(ggplot2) +library(tourr) +data(randu) +randu_std <- as.data.frame(apply(randu, 2, function(x) (x-mean(x))/sd(x))) +randu_std$yz <- sqrt(35)/6*randu_std$y-randu_std$z/6 +randu_df <- randu_std[c(1,4)] +randu_huber <- prep_huber(randu_df, index = norm_bin(nr = nrow(randu_df))) + +ggplot() + + geom_huber(data = randu_huber$idx_df, aes(x = x, y = y)) + + geom_point(data = randu_df, aes(x = x, y = yz)) + + geom_abline(slope = randu_huber$slope, intercept = 0) + + theme_huber() + + coord_fixed() + +ggplot(randu_huber$proj_df, aes(x = x)) + + geom_histogram(breaks = seq(-2.2, 2.4, 0.12)) + + xlab("") + ylab("") + + theme_bw() + + theme(axis.text.y = element_blank()) +}