I have a data frame that is fairly simple. It is a skills matrix for employees that contains user and 35-36 columns of IT skills with a ranking from 0-5. I summed each column and then sorted them DESC by skill value. Now I am looking to create a bar graph, but not sure what to put for the x value.
I have tried using colsums and colnames
Read CSV into R
skillsMatrix <- read.csv(file="skillsmatrix.csv", header=TRUE, sep=",")
colsums
to find skills with highest values, sorted DESC
skills <- skillsMatrix[,names(sort(colSums(skillsMatrix[-1:-2]), decreasing = T))]
skills
library(ggplot2)
g <- ggplot(skills, aes(x= colSums(skills)), y=(colnames(skills))) +
geom_bar(stat = "identity", colour = "black")
g
expected results is to get a bar graph showing each skill with its value in descending order.
Actual result is this error:
Error: Aesthetics must be either length 1 or the same as the data (55): x
here is some output from str(skills)
to give you an idea.
> str(skills)
'data.frame': 55 obs. of 35 variables:
$ SQL : int 4 3 2 3 3 2 3 3 3 4 ...
$ IIS : int 4 3 2 4 2 1 4 0 2 4 ...
$ SQL.Server..SSIS..SSAS..SSRS. : int 3 3 2 3 3 1 3 3 2 3 ...
$ C. : int 4 4 2 3 2 1 0 0 2 4 ...
$ .Net..WCF..WPF. : int 4 2 1 2 2 2 0 0 2 4 ...
$ VB..Net : int 4 2 1 3 2 1 0 0 1 4 ...
$ HTML.5 : int 3 4 3 2 1 1 0 2 1 2 ...
$ Java.Script : int 3 3 2 1 3 1 0 2 1 3 ...
$ AppInsights : int 1 1 1 3 2 0 3 0 0 3 ...
$ Angular.JS : int 2 3 2 2 2 0 0 2 2 2 ...