[R] Kohonen Package

Gavin Simpson gavin.simpson at ucl.ac.uk
Sun Nov 29 12:21:37 CET 2009


On Sat, 2009-11-28 at 17:16 -0700, Peter Ehlers wrote:
> I haven't used pkg:kohonen, so this is just guessing:
> 
> 1. are you using an old version of the package?

I deleted the original email, so I'll reply here instead. The example
provided by the OP works for me with on R 2.10-patched and:

> packageDescription("kohonen")$Version
[1] "2.0.5"

Looking at the CHANGES file in the package, "dist.neighbours" was added
in version 2.0.5, so I suspect the OP was using an older version, but
reading a newer version of the help as a PDF.

> 
> 2. don't call the output of function som() 'som'. As
> people around here might say: would you call your
> iguana 'iguana'?

Indeed:

##install.packages("fortunes") ## uncomment if not installed
require("fortunes")
fortune("dog")

HTH

G

> 
> 3. have you used str() on your object to check what
> it really contains? I would guess that it should be
> of class som and have a component 'distances'.
> 
> If none of that helps then it's beyond me.
> 
>   -Peter Ehlers
> 
> 
> Brock Tibert wrote:
> > Hi All,
> > 
> > I am still learning R, but making, IMO, great strides.  I learned about Kohonen/Self-Organizing Maps in class and I would like to try to replicate some of the things we have seen in class.
> > 
> > Below is my code.  I am trying to create a u-matrix.  In the documentation on page 9 it appears the type of plot, dist.neighbours should do the trick, however, I am getting an error:
> > (Error in match.arg(type) : 'arg' should be one of "codes", "changes", "counts", "mapping", "property", "quality")
> > 
> > Since I am new to R, I figure I am missing something obvious.  Any help you can provide will be greatly appreciated!
> > 
> > Thanks in advance,
> > 
> > Brock
> > 
> > library(kohonen)
> > 
> > data("wines")
> > wines.sc <- scale(wines)
> > 
> > som <- som(wines.sc, grid=somgrid(5, 5, "hexagonal"))
> > plot(som)
> > plot(som, type="dist.neighbours" )
> > 
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> > 
> >
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list