Re: [R] inf.rm function?

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Sun, 27 Jun 2010 19:39:21 -0400

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_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.



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 Sun 27 Jun 2010 - 23:41:32 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 Sun 27 Jun 2010 - 23:50:42 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