[R] PAM Clustering
ulrik.stervbo at gmail.com
Mon Jul 10 17:44:14 CEST 2017
read.csv2 use ',' as the decimal separator. Since '.' is used in your file,
everything becomes a character which in turn makes pam complain that what
you pass to the function isn't numeric.
Use read.csv2("data.csv", dec = ".") and it should work.
You can also use class(d) to check the class of the matrix before you pass
it to pam().
See ?read.table for more options.
There is a base function called 'data', so naming a variable data is a poor
On Mon, 10 Jul 2017 at 17:25 Sema Atasever <s.atasever at gmail.com> wrote:
> Dear Authorized Sir / Madam,
> I have an R script file in which it includes PAM Clustering codes:
> *when i ran R script i am getting this error:*
> *Error in pam(d, 10) : x is not a numeric dataframe or matrix.*
> *Execution halted*
> How can i fix this error?
> Thanks in advance.
> data <- read.csv2("data.csv")
> cluster.pam = pam(d,10)
> filenameclu = paste("clusters", ".txt")
> write.table(cluster.pam$clustering, file=filenameclu,sep=",")
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help