Re: [R] question on creating a new logical variable

From: Paul Roebuck <roebuck_at_odin.mdacc.tmc.edu>
Date: Fri 12 Aug 2005 - 02:42:57 EST

On Thu, 11 Aug 2005, Renuka Sane wrote:

> I have two variables.
> A <- rep(c(1:9), 2)
> B <- rep(c(2:10),2)
>
> I want to know the the value for
> A==1 and B==1
>
> [SNIP]
>
> To solve the problem I therefore create a new variable
> C <- c(A, B)
> and then do table(C==1) which gives me
> FALSE TRUE
> 34 2
>
> Is there a way to do this without making the new variable C?

You mean something besides not explicitly creating it?

table(c(A, B) == 1)



SIGSIG -- signature too long (core dumped)

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Aug 12 02:46:52 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:15:02 EST