CalculateAxisPath: Calcule les trajectoires par axe pour un diagramme en radar...

View source: R/functions.R

CalculateAxisPathR Documentation

Calcule les trajectoires par axe pour un diagramme en radar (Calculate Axis Path)

Description

Calculates x-y coordinates for a set of radial axes (one per variable being plotted in radar plot)

Usage

CalculateAxisPath(var.names, min, max)

Arguments

var.names

list of variables to be plotted on radar plot

min

MININUM value required for the plotted axes (same value will be applied to all axes)

max

MAXIMUM value required for the plotted axes (same value will be applied to all axes)

Value

a dataframe of the calculated axis paths

Examples

library(dplyr)
library(scales)
library(tibble)

mtcars_radar <- mtcars %>%
  as_tibble(rownames = "group") %>%
  mutate_at(vars(-group), rescale) %>%
  tail(4) %>%
  select(1:10)
plot.data <- as.data.frame(mtcars_radar)
if(!is.factor(plot.data[, 1])) {
  plot.data[, 1] <- as.factor(as.character(plot.data[, 1]))
  }
names(plot.data)[1] <- "group"
var.names <- colnames(plot.data)[-1]
grid.min = 0
grid.max = 1
centre.y = grid.min - ((1 / 9) * (grid.max - grid.min))
CalculateAxisPath(var.names, grid.min + abs(centre.y), grid.max + abs(centre.y))

sageR documentation built on March 31, 2023, 6:16 p.m.