hadley wickham hwickhamgmailcom tue aug 5 2008 1159 wrote set data basically sales figures given year columns yeaqr day year sku subcatetory category first lines data look like year dayofyear sku quantity catid category subcategory 1 2007 1 100091 1 10862 holiday christmas 2 2007 1 100138 1 11160 pet costumes famous licensed 3 2007 1 100194 1 10749 hats wigs masks wigs womens 4 2007 1 100432 1 10865 holiday easter 5 2007 1 100911 1 10120 men superheroes men following help summarize data various columns libraryreshape meltt2007 idvarcdayofyearcategorysubcategorysku measurevarcquantity following seems give sales day year headcastt dayofyear variable sum dayofyear quantity 1 1 861 2 2 1732 3 3 2124 4 4 1801 5 5 2147 6 6 1312 want get sales day year category following doesnt seem right headcastt dayofyear category variable sum 1 na 2 na na 2 na look castt dayofyear category variable sum 3d array probably want probably want castt dayofyear category variable sum id suggest reading introduction reshape pdf hadley httphadconz ______________________________________________ rhelprprojectorg mailing list httpsstatethzchmailmanlistinforhelp please read posting guide httpwwwrprojectorgpostingguidehtml provide commented minimal selfcontained reproducible code tue 05 aug 2008 155457 0600 r reshape cast help