[R-sig-Geo] Creating nb object with cell2nb
Roger Bivand
Roger.Bivand at nhh.no
Sun Feb 24 11:27:35 CET 2008
On Sun, 24 Feb 2008, Michal Gallay wrote:
> Dear R User's,
Please DO NOT reply on an earlier thread, changing the message subject, if
you want to start a new thread. Please start a new thread from a fresh
message (copy the list address to a fresh message)! This message is seen
in the archives and on gmane (and everywhere else using threads as a
continuation of the thread on shape of circles.
I'll continue in the thread for now, since it is here.
>
> after attempting to create and 'nb' object with cell2nb
> following errror had come up:
>
> install.packages(spdep)
> require(spdep)
> cell2nb(10,10, type="rook")
> Error in UseMethod("as.logical") : no applicable method for "as.logical"
>
> I am using R-2.6.2.
This has come up several times, both on and off list, and is related to
NEWS for the 2.6.* release:
o Making functions primitive changes the semantics of S4
dispatch: these no longer dispatch on classes based on types
but do dispatch whenever the function in the base name space is
called.
This applies to as.complex(), as.integer(), as.logical(),
as.numeric(), as.raw(), expm1(), log(), log1p(), log2(),
log10(), gamma(), lgamma(), digamma() and trigamma(), as
well as the Math2 and Summary groups.
Because all members of the group generics are now primitive,
they are all S4 generic and setting an S4 group generic does
at last apply to all members and not just those already made
S4 generic.
as.double() and as.real() are identical to as.numeric(), and
now remain so even if S4 methods are set on any of them.
Since 'as.numeric' is the traditional name used in S4,
currently methods must be exported from a NAMESPACE for
'as.numeric' only.
It is also mentioned in Breaking news on http://www.R-project.org/Rgeo/,
point 3. In fact, it can stem from a stale Matrix package in a library in
.libPaths() - where R looks for pacjkages - or from a stale methods
package in the same search path. If you say library(), I guess you will
see something stale in a library. You may also have followed the (bad)
advice in the R for Windows FAQ to "copy across" packages from a library
for an earlier R installation on upgrading.
It is far safer to allow base and recommended R packages to live in the
default library, and create your own library in a separate directory,
using the R_LIBS environment variable (or .libPaths()) to add it to the
library search path. When an incompatible upgrade of the R engine happens,
you just fire up the new R, say update.packages(checkBuilt=TRUE), and
relax. If any packages need freshening, this will be taken care of
automatically.
This is also mentioned in:
https://stat.ethz.ch/pipermail/r-sig-geo/2007-November/002786.html
which gets you to:
https://stat.ethz.ch/pipermail/r-help/2007-October/142367.html
Roger
>
> I much appreciate your help.
>
> Regards
>
> Michal
>
>
> --
> Michal Gallay
>
> Postgraduate Research Student
> School of Geography, Archaeology and Palaeoecology
> Queen's University
> Belfast BT7 1NN
> Northern Ireland
>
> Tel: +44(0)2890 273929
> Fax: +44(0)2890 973212
> email: mgallay01 at qub.ac.uk
> www: www.qub.ac.uk/geog
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list