[R] correlation matrix between data from different files

jeff6868 geoffrey_klein at etu.u-bourgogne.fr
Thu Apr 12 17:24:44 CEST 2012


Dear users,

I'm quite a new french R-user, and I have a problem about doing a
correlation matrix.
I have temperature data for each weather station of my study area and for
each year (for example, a data file for the weather station N°1 for the year
2009, a data file  for the N°2 for the year 2010, ....). So I have 70
weather stations with one data file per year since 2005. Each station has 4
temperature sensors.
Each data file has exactly the same structure: date&hour, sensor1, sensor2,
sensor3, sensor4. Here's an example:

time    	                  sensor1	sensor2	sensor3sensor4
01/01/2008 00:00	-0.25	-2.43	-3.25	-2.37
01/01/2008 00:15	-0.18	-2.37	-3.18	-2.25
01/01/2008 00:30	-0.25	-2.5	        -3.37	-2.56
01/01/2008 00:45	-0.25	-2.37	-3.31	-2.37

I need to do a matrix correlation between each same sensors of the different
stations (one correlation matrix between all the sensors 1 of the 70
stations, another one for sensor 2, ...). 
I have to find for each year and each station the best correlation. For
example, which one of the 70 weather stations is the most well correlated
with station 1 for the sensor 1? and with station 2? ... and so one for each
sensor and each station.

Example:

Sensor 1 for the year 2009

                   Station 1 Station 2 Station 3 [...]
Station 1         1       0.910         0.748
Station 2     0.910        1                0.6 
Station 3      0.748       0.6              1   
[...]

And the same for year 2005,2006,2007,2008,2009,2010,2011 for each of the 4
sensors.

Have you got any idea how can I do this on R? 
Should I first merge all the sensors in one file or could I do it with data
in separate files (like I have for the moment)?
Thank you very much for all your answers!


--
View this message in context: http://r.789695.n4.nabble.com/correlation-matrix-between-data-from-different-files-tp4552226p4552226.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list