Learn R Programming

sageR (version 0.6.1)

CalculateAxisPath: 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)

Value

a dataframe of the calculated axis paths

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)

Examples

Run this code
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))

Run the code above in your browser using DataLab