[R] Generation of labels for 2 factors

Xavier Fernández i Marín xavier.fim at eresmas.net
Tue Sep 30 17:42:02 CEST 2003


Hello,

I have a data set with 10 countries, 10 sectors of public policy and 15 years 
like
country	sector	year
a	aa	1980
a	aa	1981
...
a	bb	1980
a	bb	1981
...
b	aa	1980
b	aa	1981
...
b	bb	1980
b	bb	1981
....

with 1500 observations.

My cases are the couple country/sector. So, I want to have 100 cases over 15 
years. (both country and sector are factors)

I want to assign to each case a label (e.i. country 'a' + sector 'aa' have 
value '1', country 'a' + sector 'b' have value 2...) and I have been trying 
differents ways, but I can't.


Is there a function to do it directly or I have to write a function? 

Thank you,


Xavier




More information about the R-help mailing list