I want to get pvalues from a data set. I have not had any problems to use pnorm, but I have now.
data(iris)
iris[,-5]<- scale(as.matrix(iris[,-5]))
# K-Means Cluster Analysis
fit <- kmeans(iris[,-5], 5) # 5 cluster solution
# get cluster means
aggregate(iris[,-5],by=list(fit$cluster),FUN=mean)
# append cluster assignment
mydata <- data.frame(iris, fit$cluster)
pval<- pnorm(iris[,-5])
After this, I get message of "Error in pnorm(q, mean, sd, lower.tail, log.p) : Non-numeric argument to mathematical function".
What is the problem? I do not understand why this is happening.
Please let me know.
You are trying to pass a dataframe to a function that is requesting a numeric vector:
Try passing just a single column, like: