[R] problems with subset (misunderstanding somewhere)
Wladimir Eremeev
wl at eimb.ru
Tue Apr 5 13:51:40 CEST 2005
Dear r-help,
I have the following function defined:
cubic.distance<-function(x1,y1,z1,x2,y2,z2) {
max(c(abs(x1-x2),abs(y1-y2),abs(z1-z2)))
}
I have a data frame from which I make subsets.
When I call
subset(dataframe,cubic.distance(tb19h,tb37v,tb19v,190,210,227)<=2)
I have the result with 0 rows.
However, the data frame contains the row (among others, that suit)
tb19v tb19h tb37v
226.6 189.3 208.4
Call
cubic.distance(189.3,208.4,226.6,190,210,227)
gives
[1] 1.6
Next call:
> cubic.distance(189.3,208.4,226.6,190,210,227)<=2
[1] TRUE
It seems to me, that I have made errors somewhere in calls.
Could you, please, be so kind, to tell me, where they are?
Thank you.
--
Best regards
Wladimir Eremeev mailto:wl at eimb.ru
==========================================================================
Research Scientist, PhD Leninsky Prospect 33,
Space Monitoring & Ecoinformation Systems Sector, Moscow, Russia, 119071,
Institute of Ecology, Phone: (095) 135-9972;
Russian Academy of Sciences Fax: (095) 135-9972
More information about the R-help
mailing list