Questions tagged [reshape2]

The reshape2 package in R contains functions that allow data to be transformed into more convenient forms.

reshape2 is an package for flexibly restructuring and aggregating data. Its primary use is ing data between wide format with repeated measurements in separate columns of the same record and long format with the repeated measurements in separate records.

reshape2 succeeds the reshape package, and is succeeded by the package.

Repositories

Other resources

Related tags

1177 questions
-3
votes
2 answers

Pivot table (extracting row-specific data) in R

I have monthly rainfall data for a location for a period of 150 yrs predicted by 22 different models. The columns look like: Year Month Model1 Model2 Model3 .....Model 22 The data look like: 1950 1 75 90 120...67 1950 2 .. .. .. .. .. 1950 (repeat…
-4
votes
1 answer

R formating long data to wide data... but with linked results

Can anyone help arranging long data to wide data, but complicated by linked results, ie listed in wide format identified by Study Number this repetitive results listed in wide format after the SN (I've shown an abbreviated table there are more…
-4
votes
1 answer

Using reshape function in R, with constant variables varying

I want to use the reshape function in R with wide format to analyze weather data noted from stations over three years: 1996, 2006, and 2016. I have combined the three data sets in long format manually, but some variables such as longitude and…
Dead Man
  • 79
  • 1
  • 7
-4
votes
1 answer

When I try to convert my data from long to wide but I'm getting "Aggregation function missing: defaulting to length" error

My data is state prod_year num_oil_wells AK 2009 10 AK 2008 8 AK 2007 16 AK 2006 17 AK 2005 15 AK 2004 11 AK 2003 9 AK 2002 14... I want it to be in the following format; state 2009 2008 2007 AK 10 8 …
-5
votes
2 answers

Data mutate in R

I have a data frame like this: Var1 Var2 value x5 x1 2 x6 x1 6 x1 x2 2 x5 x2 2 x6 x2 4 x7 x2 3 And I'd like to reshape/aggregate/summarise it according to corresponding Var2 with minimum values of each pairs of Var1, just…
lgadar
  • 169
  • 1
  • 8
-5
votes
1 answer

Convert an upper to lower triangle matrix in r

I looked inot several posts, but I still couldn't find a way to just transform an upper triangle matrix into a lower triangle matrix. I just want this: 1 2 3 a 10 11 12 b 13 14 c 15 To become this: a b c 1 …
GabrielMontenegro
  • 683
  • 1
  • 6
  • 21
1 2 3
78
79