Learn R Programming

sageR (version 0.6.1)

CalculateGroupPath: Calcule les trajectoires par groupe pour un diagramme en radar (Calculate Group Path)

Description

Converts variable values into a set of radial x-y coordinates

Usage

CalculateGroupPath(df)

Value

a dataframe of the calculated axis paths

Arguments

df

a dataframe with Col 1 is group ('unique' cluster / group ID of entity) and Col 2-n are v1.value to vn.value - values (e.g. group/cluser mean or median) of variables v1 to v.n

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"
CalculateGroupPath(plot.data)

Run the code above in your browser using DataLab