On Jun 25, 2010, at 9:31 PM, Julia Choi wrote:
Dear All:
I have been trying to remove "Inf" values from a series of data
(multiple ratio operations). I have tried the na.rm() function (and
tried this inside mean(), median(), and var()) but this does not
always work. Though the !is.finite() or is.infinite() functions
appear to be very promising, this would require the creation of an
intermediary variable and would make the direct creation of a
data.frame() from a series of ratios much less convenient.
Would anyone have a hint on a function similar to na.rm(), except it
removes Inf values? Would anyone in the R project be possibly
interested on adding this functionality?
Minimal example:
TissueRatios = rbind(
rbind(c(median(XmodA$IDPG[XmodA$Organ=="Tumor" & XmodA$Time=="48h"]/
XmodA$IDPG[XmodA$Organ=="Blood" & XmodA$Time=="48h"], na.rm=TRUE),
var(XmodA$IDPG[XmodA$Organ=="Tumor" & XmodA$Time=="48h"]/XmodA
$IDPG[XmodA$Organ=="Blood" & XmodA$Time=="48h"], na.rm=TRUE), 1, 1,
1),
c(median(XmodA$IDPG[XmodA$Organ=="Tumor" & XmodA$Time=="72h"]/XmodA
$IDPG[XmodA$Organ=="Blood" & XmodA$Time=="72h"], na.rm=TRUE),
var(XmodA$IDPG[XmodA$Organ=="Tumor" & XmodA$Time=="72h"]/XmodA
$IDPG[XmodA$Organ=="Blood" & XmodA$Time=="72h"], na.rm=TRUE), 2, 1,
1),
c(median(XmodA$IDPG[XmodA$Organ=="Tumor" & XmodA$Time=="96h"]/XmodA
$IDPG[XmodA$Organ=="Blood" & XmodA$Time=="96h"], na.rm=TRUE),
var(XmodA$IDPG[XmodA$Organ=="Tumor" & XmodA$Time=="96h"]/XmodA
$IDPG[XmodA$Organ=="Blood" & XmodA$Time=="96h"], na.rm=TRUE), 3, 1,
1)), . . .)
That is not really a minimal example. For one thing it will not parse
correctly with the three dots at the end. I think it is unreasonable
to expect us to parse out some pattern from that curious mixture of
logical and numeric operators. It is a fairly simple operation to use
functions like is.infinite in subset(), but I cannot tell whether that
is what would suffice since I cannot see the pattern in the reference
to dataset that we cannot see.
Thank you in advance for any help!
Julia
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.