Re: [Rd] Lemon drops

From: Marc Schwartz <MSchwartz_at_medanalytics.com>
Date: Tue 15 Mar 2005 - 17:28:57 GMT

On Tue, 2005-03-15 at 18:05 +0100, Peter Dalgaard wrote:
> I bumped into the following situation:
>
> Browse[1]> coef
> deg0NA deg4NA deg8NA deg0NP deg4NP deg8NP
> (Intercept) 462 510 528 492 660 762
> Browse[1]> coef[,1]
> [1] 462
> Browse[1]> coef[,1,drop=F]
> deg0NA
> (Intercept) 462
>
> where I really wanted neither, but
>
> (Intercept)
> 462
>
> Anyone happen to know a neat way out of the conundrum?
>
> I can think of
>
> rowSums(coef[,1,drop=F])
>
> or of course
>
> val <- coef[,1]
> names(val) <- rownames(x))
>
> but the first one is sneaky and the second gets a bit tedious...

Peter,

How about something like this:

> x

            deg0NA deg4NA deg8NA deg0NP deg4NP deg8NP (Intercept) 462 510 528 492 660 762 IV1 1 2 3 4 5 6

> x[1]

(Intercept)

        462

> str(x[1])

 Named num 462

Does that work or am I missing something?

Marc Schwartz



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Mar 16 04:31:45 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:01 GMT