'Clprofiles() not working for clustmixtype package?

This is obviously a very specific question related to the ClustMixType package, so if you have experience with this kproto clustering package please help!

I've already looked thoroughly at the documentation: https://www.rdocumentation.org/packages/clustMixType/versions/0.2-15/topics/clprofiles

I'm not sure why clprofiles is not showing its usual visualizations, it did at some point but something I changed caused it to not. When I label the function, R reads it as a null.

My data contains just numerical and factor data.


#Importing Data
library(readxl)
Credit_Data <- read_excel("C:/Users/danor/Downloads/Credit_Datab.xls")

#standardization of data
Credit_Data$DURATION <- scale(Credit_Data$DURATION)
Credit_Data$AMOUNT <- scale(Credit_Data$AMOUNT)
Credit_Data$INSTALL_RATE <- scale(Credit_Data$INSTALL_RATE)
Credit_Data$NUM_CREDITS <- scale(Credit_Data$NUM_CREDITS)
Credit_Data$NUM_DEPENDENTS <- scale(Credit_Data$NUM_DEPENDENTS)
Credit_Data$AGE <- scale(Credit_Data$AGE)



##Clustering
library(clustMixType)
clusterdata <- subset(Credit_Data, select = -c(OBS))
clusterdata$CHK_ACCT <- as.factor(clusterdata$CHK_ACCT)
clusterdata$HISTORY <- as.factor(clusterdata$HISTORY)
clusterdata$SAV_ACCT <- as.factor(clusterdata$SAV_ACCT)
clusterdata$EMPLOYMENT <- as.factor(clusterdata$EMPLOYMENT)
clusterdata$PRESENT_RESIDENT <- as.factor(clusterdata$PRESENT_RESIDENT)
clusterdata$JOB <- as.factor(clusterdata$JOB)


k.max <- 15
wss <- sapply(1:k.max, function(k){kproto(clusterdata, k)$tot.withinss})
plot(1:k.max, wss,
     type="b", pch = 19, frame = T, 
     xlab="Number of clusters K",
     ylab="Total within-clusters sum of squares")

# Apply k prototypes
a <- lambdaest(clusterdata)
res <- kproto(clusterdata, k= 4, lambda = a)
k <- clprofiles(res, clusterdata)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source