0
組
重塑一個data.frame我想下表轉如何通過
+---------+----------+------+-------+
| var | Year | A | B |
+---------+----------+ -----+-------+
| Mean | 2006 | 1.3 | 4.6 |
| Median | 2006 | 1.4 | 4.1 |
| Mean | 2007 | 3.6 | 5.5 |
| Median | 2007 | 4.0 | 5.5 |
| Mean | 2008 | 5.5 | 4.0 | `
| Median | 2008 | 5.5 | 5.1 |
+---------+----------+------+-------+
喜歡的東西:
+---------+----------+------+--------+
| var | Year | Mean | Median |
+---------+----------+ -----+--------+
| A | 2006 | 1.3 | 1.4 |
| | 2007 | 3.6 | 4.0 |
| | 2008 | 5.5 | 5.5 |
| B | 2006 | 5.5 | 4.6 |
| | 2007 | 5.5 | 5.5 | `
| | 2008 | 5.1 | 5.1 |
+---------+----------+------+--------+
我試圖用重塑移調但主要困難是使這一年保持多頭。
請以可重現的形式提供您的數據。即顯示'dput(yourdata)' –
數據的結果。下次會記住它。 – DJJ