[R] inf.rm function?

From: Julia Choi <julchoi_at_ucdavis.edu>
Date: Fri, 25 Jun 2010 18:31:20 -0700


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)), . . .)

Thank you in advance for any help!
Julia



R-help_at_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. Received on Sat 26 Jun 2010 - 01:36:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 28 Jun 2010 - 00:40:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive