[R] "& not meaningful for factors"

From: Philip Twumasi-Ankrah <nana_kwadwo_derkyi_at_yahoo.com>
Date: Wed, 04 Jun 2008 05:10:01 -0700 (PDT)

I am trying to define groupings from levels of factor variables and this the warning message that R give

 "& not meaningful for factors".

The nature of my task is this. I have a variable stage which has the levels (1B, 2A, 2B) - these are the AJCC TNM stages of cancer, and another variable diameter with factor levels ("=< 4", "4 - 6.5, > 6.5; limit values are exclusive).

I am trying to define series of groupings based on these variables and others like them.

My first attempts were;

  1. node1 <- data.trt[data.trt$stage=="1B" & data.trt$diameter=="=< 4"]
  2. data.trt$stage[data.trt$stage=="1B"]& data.trt$diameter[data.trt$diameter=="=< 4"]

The second attempt was purely a fishing exercise.

R gave me the waring message:

Warning message:
In Ops.factor(data.trt$stage[data.trt$stage == "1B"], data.trt$diameter[data.trt$diameter == :   & not meaningful for factors

My question is how do I get round this and by implication is there an alternative way of defining a logical operation applicable to factors.

Thanks already for the help.


A Smile costs Nothing

     But Rewards Everything

Happiness is not perfected until it is shared

                                                              -Jane Porter        

	[[alternative HTML version deleted]]

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 Wed 04 Jun 2008 - 12:43:43 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 Wed 04 Jun 2008 - 13:30:37 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