



Dear help list: I am trying to reshape a data frame from long to wide format and with a reduced variable list using reshape2.  The original data frame format is: Site     Obs_no   LengthSite 1   Obs 1      10Site 1   Obs 2      13Site 1   Obs 3      14.........Site 2   Obs 1      5Site 2   Obs 2      7Site 2   Obs 3      9 Site and Obs_no are factors and Length is a numeric variable.  There are 15 cases in each Site group.  The objective is to rearrange to: Site 1   Site 210        513        714        9 ........ I have tried a variety of approaches, none of which worked.  The following code does not work but suggests the task might be possible, perhaps in 2 steps. Df2 <- dcast (Data1, Length ~ Site, value_var = "Length")  Its output is: Length   Site 1   Site 210            10      NA13            13      NA14            14      NA.......5             NA     57             NA     79             NA     9 One easy solution is to reshape in Excel and import a new dataframe for use but I would like to do it in R.  Any suggestions would be much appreciated. Regards,BJ  		 	   		  
	[[alternative HTML version deleted]]

