R data preparation for cluster use

2

I have a database, where in the first column are some basketball teams and the following columns are some observed variables. I would like to do a cluster analysis using such packages:

library("cluster") ;
library("factoextra") ;
library("magrittr")

Database:

Whenreadingmydatabasethatwasincsv,Iturneditintoadata.frame,butinanattempttoscalethevariableswiththecodebelow,thiserrorappearssayingthatmy"Time" column should be numeric and thus consequently I can not also do the correlation matrix because in the label some random numbers appear instead of the name of the teams.

ERROR

my_data <- na.omit(my_data)
my_data <- scale(my_data)


Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric

CORRELATION GRAPHIC ERROR

res.dist <- get_dist(my_data, stand = TRUE, method = "pearson")
fviz_dist(res.dist, gradient = list(low = "#00AFBB", mid = "white", high = "#FC4E07"))

Does anyone know how to solve this?

    
asked by anonymous 21.11.2017 / 15:57

1 answer

1

As Rui said in the comment, the image of your data does not help us to help you. As for doubt, the scale function needs your bank to be a numeric array. One solution is to transform the column with the name of the teams in the name of the lines:

row.names(my_data) <- my_data[,1]
my_data <- my_data[,-1]

and then move on with your code. Probably the second mistake will not happen again.

    
21.11.2017 / 16:19