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

Description Usage Arguments Value Examples

View source: R/functions.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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 July 20, 2021, 9:08 a.m.