[R] reshape question

From: GOUACHE David <D.GOUACHE_at_arvalisinstitutduvegetal.fr>
Date: Thu, 03 May 2007 18:20:37 +0200

Hello all,

A quick question concerning a behavior of reshape I fail tu understand, probably something obvious but I just can't see it.

With the following data frame further referred to as tab :

A;22/10/2004;38527;Partie aérienne.Verse;3.23;38516;Grain.Humidité;0.71;38523;Grain.Humidité;0.67;38526;Grain.Humidité;0.61;38530;Grain.Humidité;0.56;38532;Grain.Humidité;0.53;38537;Grain.Humidité;0.47;38539;Grain.Humidité;0.45;38544;Grain.Humidité;0.44;38551;Grain.Humidité;0.17
B;22/10/2004;38527;Partie aérienne.Verse;3.45;38516;Grain.Humidité;0.76;38523;Grain.Humidité;0.68;38526;Grain.Humidité;0.63;38530;Grain.Humidité;0.59;38532;Grain.Humidité;0.54;38537;Grain.Humidité;0.49;38539;Grain.Humidité;0.48;38544;Grain.Humidité;0.46;38551;Grain.Humidité;0.15

I execute the following command :


This gives me what I need except for a small glitch : I end up with the column Variable_Mesure containing the numerical values which were contained in the Valeur_Mesure.number columns of the wide data frame and conversely I have in the column Valeurs_Mesure column of my long dataframe the factor levels contained in the Variable_Mesure.number columns of the original wide dataframe.

What is this "inversion" due to ? If it is an error on my part, which I suppose it is, how do I correct this ?

Thanls in advance.

PS - I am running R 2.3.1 on a Windows platform

David Gouache
Arvalis - Institut du Végétal
Station de La Minière
78280 Guyancourt
Tel: / Port:

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 Thu 03 May 2007 - 16:34:29 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 Thu 03 May 2007 - 17:31:22 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.