[R-sig-Geo] Problem with %IN% ==FALSE when data frames are equal
Jim Burke
j.burke at earthlink.net
Tue Jul 14 00:55:19 CEST 2009
Hi everyone
I have a issue with %IN% using FALSE deep within my
R code processing. It errors if the comparison data
frames are equal.
DESIRED WORK AROUND: I would like examine my %IN% data
frame fields before submitting then to the erroring
block of code. Then appropriately trap this error.
Any suggestions?
OVERVIEW: seems [sp$block %IN% df$ID==FALSE] chokes when
sp and df contain equal variables. My normal processing is
to take the larger sp and get all larger sp blocks that
are not in the smaller sp. As I process the list, it
goes well until the last item when both sets of data
frame variables are equal.
PROBLEM:
###############################################
## remove blocks that we just found in pct_blk_df
###############################################
tmp_hd_census_blk_sp <- hd_census_blk_sp [ (hd_census_blk_sp$BLKIDFP00
%in% pct_blk_df$ID==FALSE),]
Error in lst[[i]] : subscript out of bounds
> traceback()
2: .bboxCalcR(x at polygons)
1: hd_census_blk_sp[(hd_census_blk_sp$BLKIDFP00 %in% pct_blk_df$ID ==
FALSE), ]
INPUTS:
> hd_census_blk_sp$BLKIDFP00
[1] 481130089001000 481130086032001 481130034002043 481130086032002
[5] 481130034002046 481130086032004 481130034002047 481130086032000
[9] 481130086032009 481130034002044 481130086032005 481130034002048
[13] 481130089001013 481130086032007 481130086032010 481130089001014
[17] 481130086032003
28480 Levels: 481130001001000 481130001001001 481130001001002 ...
481130199004013
> pct_blk_df$ID
[1] 481130089001000 481130086032001 481130034002043 481130086032002
[5] 481130034002046 481130086032004 481130034002047 481130086032000
[9] 481130086032009 481130034002044 481130086032005 481130034002048
[13] 481130089001013 481130086032007 481130086032010 481130089001014
[17] 481130086032003
28480 Levels: 481130001001000 481130001001001 481130001001002 ...
481130199004013
Thanks,
Jim Burke
PS My thanks to Gledson Luiz Picharski for his help initially with this
"outside of %IN%" logic.
More information about the R-sig-Geo
mailing list