On Jan 26, 2011, at 2:06 PM, Melanie Zoelck wrote:

Hi,

I am relatively new to R and have a question regarding code. I have a data set which has data organised by location (site names, which are factors). I now want to add a new variable Region (this will be non numerical, as it will be names). Each region will contain locations. So for example:

Region: WestCoast
Locations in Region WestCoast: Tralee, Carradale and so on...

Presumably you have some sort of table with "location" and "region" and another table with perhaps "persons" and "location". You would merge these two tables with ... wait for it .... "merge":

?merge


In the future it is considered more helpful to offer a tiny data example constructed with R code to allow more complete illustrations to be offered. Please read the Posting Guide.


So each Region will contain different Locations, so that location can be nested within Region if needed.

I have found info on how to create different Age categories for example but my input is not numeric, but it is names or rather factors with a number of levels (which are place names).

I would be grateful for any assistance you may be able to provide.

Thank you!
________________________________________
Melanie Zoelck
86 Gleann Na Ri
Renmore
Galway
Ireland


David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to