Thanks, guys.
On Sat, Jun 8, 2013 at 2:17 PM, Neal Fultz wrote:
> rowSums and Reduce will have the same problems with bad data you alluded
> to earlier, eg
> cg = 1, hs = 0
>
> But that's something to check for with crosstabs anyway.
>
>
This "wrong data" thing is a distraction here. I guess I
rowSums and Reduce will have the same problems with bad data you alluded to
earlier, eg
cg = 1, hs = 0
But that's something to check for with crosstabs anyway.
Side note: you should check out the microbenchmark pkg, it's quite handy.
R>require(microbenchmark)
R>microbenchmark(
+ f1(cg,hs,es
I still argue for na.rm=FALSE, but that is cute, also substantially faster
f1 <- function(x1, x2, x3) do.call(paste0, list(x1, x2, x3))
f2 <- function(x1, x2, x3) pmax(3*x3, 2*x2, es, 0, na.rm=FALSE)
f3 <- function(x1, x2, x3) Reduce(`+`, list(x1, x2, x3))
f4 <- function(x1, x2, x3) rowSums(cbind(
I would do this to get the highest non-missing level:
x <- pmax(3*cg, 2*hs, es, 0, na.rm=TRUE)
rock chalk...
-nfultz
On Fri, Jun 07, 2013 at 06:24:50PM -0700, Joshua Wiley wrote:
> Hi Paul,
>
> Unless you have truly offended the data generating oracle*, the
> pattern: NA, 1, NA, should be a da
Hi Paul,
Unless you have truly offended the data generating oracle*, the
pattern: NA, 1, NA, should be a data entry error --- graduating HS
implies graduating ES, no? I would argue fringe cases like that
should be corrected in the data, not through coding work arounds.
Then you can just do:
x <-
5 matches
Mail list logo