Hi Rui,
Thanks for the quick reply! It was my mistake not to notice $country in
thr fourth line of your code. I went back and changed it to $name, and
got the following output when I mapped the borders:
http://i.imgur.com/DQ3IB.png
Here is the output of your function:
1> exmpl <- sub[, c(
Hello,
In your original post, there was a column named 'country', it now seems
to be 'name', therefore my function shouldn't work. To see the output of
head(9 is helpfull but the better way is dput(). Try the following:
exmpl <- sub[, c("name", "idxy", "ix", iy")]
dput( head(exmpl, 30) ) # p
Rui,
Thanks a lot for your help. Unfortunately this doesn't work though:
1> is.border <- function(idx, DF){
1+ i1 <- DF$ix %in% (DF$ix[idx] + c(-1, 1)) & DF$iy == DF$iy[idx]
1+ i2 <- DF$iy %in% (DF$iy[idx] + c(-1, 1)) & DF$ix == DF$ix[idx]
1+ any(DF$country[idx] != DF$country[i1 | i
3 c1 x3 1
#44 2 4 c1 x4 1
#55 2 4 c2 x5 1
#66 2 5 c2 x6 1
#77 3 5 c3 x7 1
#88 3 5 c3 x8 NA
#9 9 3 5 c3 x9 NA
- Original Message -
From: Andrew Crane-Droesch
To: r-
c1 x2 1
#3 3 1 3 c1 x3 1
#4 4 2 4 c1 x4 1
#5 5 2 4 c2 x5 1
#6 6 2 5 c2 x6 1
#7 7 3 5 c3 x7 1
#8 8 3 5 c3 x8 NA
#9 9 3 5 c3 x9 NA
- Original Message -
From: An
Hello,
The function in my previous post gives neighbours in north, south, east
and west but also the corners, for a total of 8, not 4, neighbours.
Corrected:
is.border <- function(idx, DF){
i1 <- DF$ix %in% DF$ix[idx] + c(-1, 1) & DF$iy == DF$iy[idx]
i2 <- DF$iy %in% DF$iy[idx] + c(-1
Hello,
You should post a data example with ?dput. If your dataset is named
MyData, use
dput( head(MyData, 30) ) # paste the output of this in a post
Anyway, I believe the following function might do what you want. It's
untested, though. (Your example dataset is usefull but could be better)
Hi All,
I'm a little stumped by the following problem. I've got a dataset with
the following structure:
idxyixiycountry(other variables)
111c1x1
212c1x2
313c1x3
... .
8 matches
Mail list logo