[R] creating a factor

Simon Hosking simon.hosking at general.monash.edu.au
Tue Feb 3 10:43:18 CET 2004


Hi list,
I'd like to make a factor with seven 1s and three 2s using the
factor() function. 
That is,

1
1
1
1
1
1
1
2
2
2
 

I will then bind this factor to the matrix below using cbind.data.frame().

0.56	0.48
0.22	0.59
0.32	0.64
0.26	0.60
0.25	0.38
0.24	0.45
0.56	0.67
0.78	0.97
0.87	0.79
0.82	0.85



I am new to R and have been using various manuals and have made many attempts without success
any help appreciated.
thanks,
Simon




More information about the R-help mailing list