[R] sorting data from dataframe with oter dataframe
ראובן אברמוביץ
gantkant at walla.com
Thu Jul 28 13:55:14 CEST 2011
Hi, the subject isn't define well the problem, so i'll explain it in detail:
i've got a csv.file with data on number of factors (every column got the
name
of the factor as header and the data below). on another csv file, i've got
the
factors sorted by their type. for example-
c1=read.csv('C:/R/c1.csv', header= TRUE)
urrDate A_XS b_XS c_XS d_XS e_XS
1 01/01/1996 0 0.0000 0 0.0000 2.7220
2 02/01/1996 0 2.3232 0 2.2960 2.7179
3 03/01/1996 0 2.3368 0 2.3087 2.7004
4 04/01/1996 0 2.3395 0 2.3173 2.6821
5 07/01/1996 0 2.3226 0 2.3072 2.6852
6 08/01/1996 0 2.3385 0 2.3067 2.7008
7 09/01/1996 0 2.3290 0 2.2960 2.6793
8 10/01/1996 0 2.3206 0 2.2907 2.6843
9 11/01/1996 0 2.3292 0 2.2845 2.6978
10 14/01/1996 0 2.3211 0 2.2926 2.6844
11 15/01/1996 0 2.3184 0 2.2863 2.6810
12 16/01/1996 0 2.3253 0 2.2880 2.6623
13 17/01/1996 0 2.3119 0 2.2779 2.6486
14 18/01/1996 0 2.3113 0 2.2844 2.6299
15 21/01/1996 0 2.3043 0 2.2907 2.6227
16 22/01/1996 0 2.2855 0 2.2819 2.6150
17 23/01/1996 0 2.2936 0 2.2821 2.6392
18 24/01/1996 0 2.3068 0 2.2883 2.6229
19 25/01/1996 0 2.3056 0 2.2837 2.6427
20 28/01/1996 0 2.3271 0 2.2904 2.6293
21 29/01/1996 0 2.3281 0 2.2796 2.5885
22 30/01/1996 0 2.3300 0 2.2774 2.5972
23 31/01/1996 0 2.3377 0 2.2712 2.5824
c2=read.csv('C:/R/c2.csv', header= TRUE, fill=TRUE)
type1 type2
1 A_XS c_XS
2 b_XS d_XS
3 e_XS
my question is how do I sort data from C1 with the headers of C2? which
means if i'll write "type1" i'll get the data of A_XS and B_XS
_________________________________________________________________
Walla! Mail - [1]Get your free unlimited mail today
References
1. http://www.walla.co.il/
More information about the R-help
mailing list