I have a dataset with Length and size variables. I have found the mean lengths of the size variables; spat=29.5, small=59.35, and market=97.0. I have also found the proportions of measured values spat=11%, small=38%, and market=50% for each of the size groupings.
I would like to fill in the un measured (na) lengths in the data set based on the proportions given above and assign each proportion a length based on the means given above.
for example 11% of the na's will be replaced with 29.5 length, 38% will be replaced with 59.35, and 50% will be replaced with 97.0
Does anyone know the code to make this work?
I'm sorry if I'm missing something, this is my first time asking a question.
Length size
NA NA
68 Small
NA NA
84 Market
NA NA
75 Small
81 Market
NA NA
32 Spat
28 Spat
18 Spat
NA NA
21 Spat
30 Spat
NA NA