i_mean_grp {COINr} | R Documentation |

## Impute by group mean

### Description

Replaces `NA`

s in a numeric vector with the grouped arithmetic means of the non-`NA`

values.
Groups are defined by the `f`

argument.

### Usage

```
i_mean_grp(x, f, skip_f_na = TRUE)
```

### Arguments

`x` |
A numeric vector |

`f` |
A grouping variable, of the same length of |

`skip_f_na` |
If |

### Value

A numeric vector

### Examples

```
x <- c(NA, runif(10), NA)
f <- c(rep("a", 6), rep("b", 6))
i_mean_grp(x, f)
```

[Package

*COINr*version 1.1.14 Index]