[R] reshape to wide format takes extremely long

carslaw david.carslaw at kcl.ac.uk
Thu Sep 2 12:36:52 CEST 2010


picking up on Thierry's example, I don't think you need any function because
you are just reshaping 
(not aggregating).  Therefore:

bigtab2 <- cast(data = big, study + subject + cycle + day  ~type, value =
"obs")
> head(bigtab2)
  study subject cycle day ALB ALP ALT AST
1     1       1     1   1  66  71  83  76
2     1       1     1   2  66  87  78  58
3     1       1     1   3  72  84  78  61
4     1       1     1   4  72  63  68  69
5     1       1     1   5  64  68  89  89
6     1       1     2   1  78  65  65  76

system.time(bigtab2 <- cast(data = big, study + subject + cycle + day 
~type, value = "obs"))
   user  system elapsed 
  0.760   0.000   0.782 

david
-- 
View this message in context: http://r.789695.n4.nabble.com/reshape-to-wide-format-takes-extremely-long-tp2487153p2506575.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list