That comment is right, it's a general programming question, and text would be much easier for people to help with rather than images.
But, since I ran into this not long ago...
Take a look at the message shown in blue just above the output table. My guess is you have some repeated ID/Condition/Wavelength combinations and it's defaulting to reporting the number of matching rows in the long-format data frame. You'll need to either make sure you have all unique combinations, or explicitly define what you expect it to do with multiple values going into a single output row/column position (like, median/mean/max/min/whatever). The unique() call won't do it since varying mean values would still make for unique input rows.
For example compare this:
> reshape2::dcast(data.frame(
+ Wavelength=c(664, 666, 662),
+ Condition="late",
+ ID=c(6221, 6222, 6223),
+ mean=c(106817, 110357, 112998)),
+ ID + Condition ~ Wavelength, value.var = "mean")
ID Condition 662 664 666
1 6221 late NA 106817 NA
2 6222 late NA NA 110357
3 6223 late 112998 NA NA
with this:
> reshape2::dcast(data.frame(
+ Wavelength=c(664, 664, 666, 662),
+ Condition="late",
+ ID=c(6221, 6221, 6222, 6223),
+ mean=c(106800, 106817, 110357, 112998)),
+ ID + Condition ~ Wavelength, value.var = "mean")
Aggregation function missing: defaulting to length
ID Condition 662 664 666
1 6221 late 0 2 0
2 6222 late 0 0 1
3 6223 late 1 0 0