The radarchart package expects data to be in a format whereby each row corresponds to an axis on the chart (or a Label) and each column is a set of scores. An example is the built in data set, skills.

library(radarchart)
skills
##          Label Aimee Andy Rich
## 1 Communicator     6    7    9
## 2 Data Wangler     5    6    7
## 3     Modeller     7    6    3
## 4   Programmer     8    6    4
## 5 Technologist     4    2    5
## 6   Visualizer     6    9    7

In many cases your data will have a column for each axis, and each row is a set of observations. In the skills example we might build up a spreadsheet where each row is a person and each column a skill.

skillsByName
##    Name Communicator Data Wangler Modeller Programmer Technologist
## 1 Aimee            6            5        7          8            4
## 2  Andy            7            6        6          6            2
## 3  Rich            9            7        3          4            5
##   Visualizer
## 1          6
## 2          9
## 3          7

In order to use this data set with radarchart we need to rotate it. This can be done with packages such as tidyr.

library(tidyr)
skillsByLabel <- gather(skillsByName, key=Label, value=Score, -Name) %>%
skillsByLabel
##          Label Aimee Andy Rich
## 1 Communicator     6    7    9
## 2 Data Wangler     5    6    7
## 3     Modeller     7    6    3
## 4   Programmer     8    6    4
## 5 Technologist     4    2    5
## 6   Visualizer     6    9    7

If you don’t want to have a dependency on tidyr then you can do the same thing using a few lines of base R code.

skillsByLabel <- as.data.frame(t(skillsByName[,-1]))
names(skillsByLabel) <- skillsByName\$Name
skillsByLabel <- cbind(Label=row.names(skillsByLabel), skillsByLabel)
row.names(skillsByLabel) <- NULL

This rotated data set is now ready for use with radarchart.

chartJSRadar(scores = skillsByLabel, maxScale = 10)