Hi all

I am trying to do a simple recode which I am stumbling on. I figure
there must be any easy way but haven't come across it.

Given data of A","B","C","D","E","A" it would be nice to recode this
into say three categories ie A and B becomes "Treat1", C becomes "Treat
2" and E becomes "Treat 3".

I tried the car library but it didn't seem to like text. Also it seems
you can only recode into two categories.


library(car)

x<-c("A","B","C","D","E","A")
x
recode(x, "c(A,B)='Treat 1'; else='Treat 2'")
recode(x, "1:2='A'; 3='B'")

In Microsoft access a simple way of recoding is to join two tables in a
query any simple way of doing the same in R?



Kind regards

Andy

Andrew McFadden MVS BVSc
Incursion Investigator
Investigation & Diagnostic Centres - Wallaceville Biosecurity New 
Zealand Ministry of Agriculture and Forestry

Phone 04 894 5600 Fax 04 894 4973 Mobile 029 894 5611 Postal address: 
Investigation and Diagnostic Centre- Wallaceville Box 40742 Ward St 
Upper Hutt


########################################################################
This email message and any attachment(s) is intended solely for the
addressee(s) named above. The information it contains is confidential
and may be legally privileged.  Unauthorised use of the message, or the
information it contains, may be unlawful. If you have received this
message by mistake please call the sender immediately on 64 4 8940100
or notify us by return email and erase the original message and
attachments. Thank you.

The Ministry of Agriculture and Forestry accepts no responsibility for
changes made to this email or to any attachments after transmission from
the office.
########################################################################

	[[alternative HTML version deleted]]


