Hi everyone,

 

I'm attempting to do some spatial analyses with a relatively simple data
set and I'm running into some issues.  Here's my code:

 

sosp09 <- read.csv("f:\\sosp\\2009\\sosp09.means.csv", header=T)

sp.point <- cbind(sosp09$x, sosp09$y)

colnames(sp.point) <- c("LONG","LAT") 

# Projection: UTM Zone 17

proj <- CRS("+proj=utm +zone=18 +datum=WGS84")

# Create spatial object

data.sp <- SpatialPointsDataFrame(coords=sp.point, data=sosp09,
proj4string=proj)

## Bounding box of data points

bbox(data.sp)

#build neighborhood

sosp.neigh <- tri2nb(data.sp)

 

And, with the last step, I get 

 

Error in anyDuplicated.default(coords) : 

  anyDuplicated() applies only to vectors

 

I went through and removed duplicated rows by averaging the responses
and I still get this message.  I also removed via rm() all the objected
from the original analysis and I still get this message.  Any ideas
what's going on?

 

Thanks,

 

Jeff

 

The data:

 

 

new("SpatialPointsDataFrame"

    , data = structure(list(band = c(6467L, 6483L, 6466L, 6465L, 6463L,
6462L, 

6498L, 6443L, 6496L, 6495L, 6459L, NA, 6458L, 6491L, 6446L, 6464L, 

NA, 6473L, 6444L, 6457L, 6468L, NA, 6485L, 6474L, 6445L, 6486L, 

6488L, 6472L, 6493L, 6492L, 6471L, 6449L, 6453L, 6460L, 6482L

), site = structure(c(19L, 26L, 18L, 17L, 15L, 14L, 35L, 1L, 

34L, 33L, 12L, 8L, 11L, 30L, 4L, 16L, 5L, 23L, 2L, 10L, 20L, 

9L, 27L, 24L, 3L, 28L, 29L, 22L, 32L, 31L, 21L, 6L, 7L, 13L, 

25L), .Label = c("SOSP0901", "SOSP0902", "SOSP0903", "SOSP0904", 

"SOSP0905", "SOSP0906", "SOSP0908", "SOSP0909", "SOSP0910", "sosp0911", 

"sosp0912", "sosp0913", "sosp0914", "SOSP0915", "SOSP0916", "SOSP0917", 

"SOSP0918", "SOSP0919", "SOSP0920", "SOSP0921", "SOSP0925", "SOSP0926", 

"SOSP0927", "SOSP0928", "Sosp0934", "Sosp0935", "Sosp0936", "Sosp0937", 

"Sosp0938", "Sosp0940", "Sosp0941", "Sosp0942", "Sosp0943", "Sosp0944", 

"Sosp0946"), class = "factor"), sex = structure(c(1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L

), .Label = "M", class = "factor"), age = structure(c(1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L), .Label = "AHY", class = "factor"), wing = c(66, 62, 66, 

65, 65, 64.5, 66, 69, 64.5, 67.5, 66, 66.5, 68, 67, 66, 67, 64.5, 

68, 65, 65, 66, 65.5, 65, 66, 64, 65, 65, 66, 66, 63, 67, 66, 

66, 65, 64), tail = c(69, 67, 69, 66, 67, 65, 66, 68, 64, 67.5, 

66, 66, 67, 67, 67, 70, 69, 64, 67, 69, 68, 65.5, 66, 67, 65, 

66, 66, 68, 71, 55, 72, 62, 70, 70, 66), bill = c(9, 9.7, 9.6, 

9.5, 9.6, 8.5, 9.2, 9.5, 8.4, 9.2, 9.9, 8.8, 8.8, 9.2, 8.6, 9.6, 

9.15, 9.7, 9.7, 8.7, 8.9, 9.45, 8.8, 9.1, 9.2, 9.2, 9.1, 8.9, 

9.6, 8.7, 9.2, 8.8, 9.2, 9, 9.3), tarsus = c(21.6, 20.6, 20.9, 

21.8, 20.9, 19.6, 22, 21.5, 21.7, 21.3, 22.1, 21.15, 19.9, 22.4, 

22, 20.1, 21.85, 21.6, 20.9, 21.5, 22.4, 21.5, 21.3, 21.2, 21.5, 

20.6, 21.4, 21.4, 21.4, 21.7, 21.4, 21.1, 20.6, 20.1, 22.2), 

    mass = c(20.8, 20.6, 21.1, 22.3, NA, 16.7, 23, 23.2, 20.7, 

    20.9, 27.3, 21.1, 21.4, 24.3, 23.2, 21.7, 22, 21, NA, 20.1, 

    20.5, 21.4, 20.5, 23.3, 21.5, 20.5, 20.8, 21, 21.3, 20.3, 

    20.4, 21, 22.9, 19.7, 21.5), x = c(1647222L, 1648242L, 1648272L, 

    1648422L, 1651242L, 1652472L, 1652472L, 1653042L, 1653282L, 

    1653372L, 1654092L, 1654212L, 1654362L, 1655082L, 1657032L, 

    1657212L, 1657272L, 1657932L, 1658292L, 1658412L, 1658772L, 

    1659072L, 1659192L, 1659342L, 1659702L, 1659762L, 1659912L, 

    1660692L, 1660872L, 1661022L, 1661082L, 1662042L, 1662192L, 

    1663362L, 1663512L), y = c(2207359L, 2206909L, 2207479L, 

    2202859L, 2203219L, 2204599L, 2198299L, 2194849L, 2202889L, 

    2208229L, 2199469L, 2199649L, 2199769L, 2202589L, 2198089L, 

    2201449L, 2198029L, 2201209L, 2202529L, 2201989L, 2203549L, 

    2202529L, 2203519L, 2201209L, 2202499L, 2204179L, 2203459L, 

    2200939L, 2208469L, 2208709L, 2201419L, 2204299L, 2204989L, 

    2206339L, 2202619L), urban1 = c(0.1724138, 0.2068966, 0.06896552, 

    0.2413793, 0.5172413, 0.34482762, 0.55172422, 0.138, 0.06896552, 

    0.03448276, 0.06896552, 1, 0.9655172, 0.4827586, 0.966, 0.8965516, 

    0.31, 1, 1, 0.99999996, 0.79310346, 1, 1.00000012, 0.99999992, 

    1, 0.99999998, 1, 0.9999999, 0.48275866, 1, 1.0000001, 1, 

    1, 1, 0.7241379), urban2 = c(0.2214765, 0.12751683, 0.18791945, 

    0.09395973, 0.24832219, 0.1946309, 0.32885906, 0.315, 0.08724833, 

    0.05369128, 0.3959732, 0.583892609, 0.77181212, 0.42281877, 

    0.758, 0.6577181, 0.564, 1.00000014, 0.993, 0.99999997, 0.63758395, 

    0.7919463, 1.00000003, 1, 1, 1.0000001, 0.73154363, 1.00000004, 

    0.59731537, 0.8993289, 0.97315443, 1, 0.913, 1.00000001, 

    0.75838925), urbank = c(0.0976826, 0.210325588, 0.360516315, 

    0.063361691, 0.060721623, 0.23995307, 0.18979175, 0.275, 

    0.065708423, 0.1589909, 0.332942288, 0.33499561, 0.3367556, 

    0.333528917, 0.557, 0.4297448, 0.561, 0.46318564, 0.29, 0.37870337, 

    0.37224991, 0.30272811, 0.34262238, 0.4197712, 0.341, 0.41126437, 

    0.3663831, 0.53300091, 0.45878559, 0.5136404, 0.46787914, 

    0.521, 0.463, 0.55148132, 0.40745079), forested1 = c(0, 0, 

    0.5172414, 0.1724138, 0, 0.20689652, 0.44827586, 0.552, 0.93103452, 

    0.724138, 0.8275862, 0, 0.03448276, 0.4482758, 0, 0, 0.345, 

    0, 0, 0, 0.03448276, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 

    0, 0.27586212), forested2 = c(0.01342282, 0, 0.302013509, 

    0.14765102, 0.04026846, 0.33557047, 0.59060398, 0.537, 0.80536914, 

    0.6308725, 0.3624162, 0.21476511, 0.19463083, 0.53020128, 

    0.208, 0.053691279, 0.268, 0, 0, 0, 0.06040268, 0, 0, 0, 

    0, 0, 0.11409395, 0, 0, 0.05369128, 0.02684564, 0, 0.034, 

    0, 0.2416107), forestedk = c(0.38163685, 0.25579349, 0.19829863, 

    0.5916691, 0.5819888, 0.48958633, 0.46758578, 0.424, 0.79319447, 

    0.5946026, 0.21120558, 0.21883251, 0.21883252, 0.46142569, 

    0.255, 0.072748608, 0.182, 0.02904077, 0.067, 0.000586682, 

    0.089469052, 0.082722209, 0.098855966, 0.01320035, 0.078, 

    0.026987389, 0.078322094, 0.009093576, 0.013493693, 0.014373716, 

    0.009093576, 0.049, 0.082, 0.03314755, 0.297154573), shrubby1 =
c(0.8275862, 

    0.7931035, 0.4137932, 0.5862069, 0.4827586, 0.2413793, 0, 

    0.31, 0, 0.2413793, 0.1034483, 0, 0, 0.06896552, 0.034, 0, 

    0.345, 0, 0, 0, 0.1724138, 0, 0, 0, 0, 0, 0, 0, 0.5172414, 

    0, 0, 0, 0, 0, 0), shrubby2 = c(0.76510064, 0.758389309, 

    0.5100671, 0.7583892, 0.7114094, 0.20805372, 0.06040268, 

    0.148, 0, 0.31543623, 0.22818796, 0.201342299, 0.033557049, 

    0, 0, 0.04697987, 0.04, 0, 0.007, 0, 0.27516781, 0, 0, 0, 

    0, 0, 0.08053692, 0, 0.4026846, 0.04697987, 0, 0, 0.034, 

    0, 0), shrubbyk = c(0.51305367, 0.513347012, 0.41947781, 

    0.341449058, 0.343502535, 0.231152806, 0.173364628, 0.172, 

    0.13229683, 0.24611325, 0.290994421, 0.243766531, 0.213552315, 

    0.066295101, 0.048, 0.044001168, 0.038, 0.01760047, 0.164, 

    0.032560866, 0.171604586, 0.116456448, 0.148430628, 0.005280141, 

    0.055, 0.024640656, 0.050748025, 0.002933411, 0.11440306, 

    0.10237605, 0, 0.045, 0.075, 0.028160755, 0.0099736), l = c(0, 

    1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0.5, 0, 0, 0, 

    0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0), p = c(0L, 1L, 

    0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 

    1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 

    1L, 0L, 0L), h = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 

    0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 

    1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), o = c(0, 0, 0, 0, 

    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, 0, 

    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), infected = c(0L, 1L, 

    0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 

    1L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 

    1L, 0L, 0L)), .Names = c("band", "site", "sex", "age", "wing", 

"tail", "bill", "tarsus", "mass", "x", "y", "urban1", "urban2", 

"urbank", "forested1", "forested2", "forestedk", "shrubby1", 

"shrubby2", "shrubbyk", "l", "p", "h", "o", "infected"), class =
"data.frame", row.names = c(NA, 

-35L))

    , coords.nrs = numeric(0)

    , coords = structure(c(1647222, 1648242, 1648272, 1648422, 1651242,
1652472, 

1652472, 1653042, 1653282, 1653372, 1654092, 1654212, 1654362, 

1655082, 1657032, 1657212, 1657272, 1657932, 1658292, 1658412, 

1658772, 1659072, 1659192, 1659342, 1659702, 1659762, 1659912, 

1660692, 1660872, 1661022, 1661082, 1662042, 1662192, 1663362, 

1663512, 2207359, 2206909, 2207479, 2202859, 2203219, 2204599, 

2198299, 2194849, 2202889, 2208229, 2199469, 2199649, 2199769, 

2202589, 2198089, 2201449, 2198029, 2201209, 2202529, 2201989, 

2203549, 2202529, 2203519, 2201209, 2202499, 2204179, 2203459, 

2200939, 2208469, 2208709, 2201419, 2204299, 2204989, 2206339, 

2202619), .Dim = c(35L, 2L), .Dimnames = list(NULL, c("LONG", 

"LAT")))

    , bbox = structure(c(1647222, 2194849, 1663512, 2208709), .Dim =
c(2L, 

2L), .Dimnames = list(c("LONG", "LAT"), c("min", "max")))

    , proj4string = new("CRS"

    , projargs = "+proj=utm +zone=18 +datum=WGS84"

)

)

 

 

 

*****************************************

Jeffrey A. Stratford, Ph.D.

Department of Health and Biological Sciences

84 W. South St.

Wilkes Univertsity, PA 18766

570-332-2942

http://web.wilkes.edu/jeffrey.stratford/

*****************************************




        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to