Re: [R] how to combine data of several csv-files

From: Antje <niederlein-rstat_at_yahoo.de>
Date: Mon, 30 Jul 2007 13:09:34 +0200

Hello,

sorry for this confusion but I don't know a better way to explain... I have no problems to read in the files and to process them. I end up with a list of results like this:

 > ret
$A02.csv
[1] NA

$B02.csv
[1] 89.130435 8.695652 2.173913 0.000000 0.000000 0.000000 9.892473

$C02.csv
[1] 86.842105 10.526316 2.631579 0.000000 0.000000 0.000000 10.026385

$D02.csv
[1] 85.000000 10.000000 5.000000 0.000000 0.000000 0.000000 4.474273

$E02.csv
[1] 70.786517 13.483146 7.865169 5.617978 2.247191 0.000000 12.125341

$F02.csv
[1] 70.83333 14.16667 10.00000 2.50000 2.50000 0.00000 17.26619

$G02.csv
[1] 64.772727 13.636364 7.954545 11.363636 2.272727 0.000000 12.735166

$H02.csv
[1] NA

$A03.csv
[1] NA

and I have a matrix with categories like this:

 > classmatrix
   1 2
A NA NA

B NA "cat1"
C NA "cat1"
D NA "cat1"
E NA "cat2"
F NA "cat2"
G NA "cat2"

H NA NA

Now, I'm looking for a way to calculate the mean element wise for all results coming from the same category:

in this case the mean of the elements:

$B02.csv
$C02.csv
$D02.csv

(belonging to "cat1")

I just don't know, how to combine the result list with the categories...

Does it become clearer? Probably, I try to provide a simple example but this will take some time to prepare...

Thanks anyway!

Antje

8rino-Luca Pantani schrieb:
> I'm unclear to what it is your problem.
> Import files into data frame?
> Combine them in one dataframe?
> Some (written) examples of the files would help people to help you out.
>
> An example on how to get help better and faster
> >>>>>>>>>>>>
> I have several csv files in the following form
> V1 V2
> 1 4
> 0.3 56
> ................
> V1 V2
> 2.5 25
> 4.5 45
> .....................
>
> I would like to import them in only one dataframe, and then recode a
> column in order to get
> V1 V2 V3
> 1 4 file1
> 0.3 56 file1
> 2.5 25 file2
> 4.5 45 file2
> .....................
> >>>>>>>>>>>>
> Antje ha scritto:

>> Hello,
>>
>> I'm looking for a solution for the following problem:
>>
>> 1) I have a folder with several csv files; each contains a set of 
>> measurement values
>>   
>

______________________________________________
R-help_at_stat.math.ethz.ch 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. Received on Mon 30 Jul 2007 - 11:14:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 30 Jul 2007 - 11:33:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.