Hey Riley,
First, you'll want to create a column that displays the average value grouped by category. The following step should accomplish this:
Transformation: Derive
Formula: AVERAGE(value_column)
Group by: category_column
New column name: average_column
Next, you'll want to replace your NAs in the column I'll refer to as your_column. To do this, you'll want to set the NA values in your_column to the values in average_column, and leave the other values as is. Since it's unclear as to whether your NA values are labeled as 'NA' or if they are missing values, I'll list ways to deal with both. If they are labeled 'NA':
Transformation: Set
Columns: your_column
Formula: IF(your_column == 'NA', average_column, your_column)
If they are missing values:
Transformation: Set
Columns: your_column
Formula: IFMISSING(your_column, average_column)
In wrangle, the above three steps look like this:
- derive value: average(value_column) group: category_column as: average_column
- set col: your_column value: IF(your_column == 'NA', average_column, your_column)
- set col: your_column value: IFMISSING(your_column, average_column)