Questions tagged [naniar]
17 questions
2
votes
2 answers
How to Test Missing At Random (MAR) in R
How do I test the assumption Missing At Random (MAR) in R?
Below are example data with code for testing completely missing at random (CMAR), and as well as imputation of missing data (which however assume MAR).
# Example Questionnaire…

John
- 309
- 3
- 12
2
votes
0 answers
naniar creating extra plot in rmarkdown
I am using the package naniar and it is producing an extra plot. I have read the documentation and could not figure out why this empty plot is appearing. Is there a way to remove it but still keep the second figure and say the second and third if…

user849541
- 176
- 8
2
votes
0 answers
MCAR test error (from naniar package): problem with mutate and"conditional number"
I'm working with some time series data frames in R (I have 166 df in a list) and almost all of them has aprox 20% of NA's (each of the df has 8760 observations). So, I'm running the test on MCAR for the missing values in order to assess the correct…
2
votes
1 answer
Is there another package than (1) naniar - , (2) BaylorEdpsych - , (3) MissMech - package including "Littles mcar_test"?
I'm doing some data processing, and I need to check the origin of my missing data before I can start multiple imputation.
Unfortunately the BaylorEdpsych and the MissMech package are not available on cran anymore and the naniar package does not do…

Ecidem
- 31
- 1
2
votes
1 answer
naniar::replace_with_na_all changes factor variables to integers?
I have a dataset where some missing values are coded as -99, and tried to use the naniar function replace_with_na_all to replace those values with NA. The function does this, but it also seems to convert my factor variables to integers, thereby…

Vasco Brazao
- 23
- 4
1
vote
2 answers
How to change the colour for missing values in geom_miss_point (with two different color scales)
I'm struggling to modifing the colour/shape/... of the points based of if it's a missing value or not.
library(ggplot2)
library(naniar)
ggplot(data = airquality,
aes(x = Ozone,
y = Solar.R)) +
geom_miss_point()
What I…

TrucMachin
- 15
- 4
1
vote
0 answers
How naniar::impute_below_all() function fills the numbers?
Given a simple df:
library(naniar)
library(tidyverse)
df <- tibble(a = c(1,NA,2,3,NA,4,5))
Please explain me why I get first NA to be 0.623 and second 0.504 after running:
df %>% bind_shadow() %>% impute_below_all()
According to the documentation…

SteveS
- 3,789
- 5
- 30
- 64
1
vote
1 answer
Changing Labels on Viss_miss
I'm trying to create a missingness diagram of my data.
I've ran the following code:
library(visdat)
library(naniar)
vis_miss(data, sort_miss = TRUE, show_perc = TRUE)
However, the labels are employment.factor or a variation instead of Employment.…

Rstudent12345
- 11
- 1
1
vote
1 answer
Converting values to NA with conditions in R
I'm trying to convert variables to NA(missing) with conditions
This is my data as example. I have 5 patients ID, If there is '1' in missing variable, outcome1 and outcome2 will be converted to NA(missing).
ID<-c("a","b","c","d","e")
…

ESKim
- 422
- 4
- 14
1
vote
2 answers
vis_miss make column titles vertical
how do you rotate the column titles in vis_miss (naniar library)?
They are tilted in the default settings, I would like the titles to be vertical (parallel to the y-axis of the graph).
Thanks for your help!

sifra
- 11
- 3
0
votes
1 answer
Plot state of boolean variables as bar over time
I am trying to do a visualisation on the state of multiple boolean variables.
I managed to get a hacky solution using naniar:
library(tidyverse)
library(naniar)
a <- c(TRUE, FALSE, TRUE,FALSE)
b <- c(FALSE, FALSE, TRUE,FALSE)
c <- c(FALSE, TRUE,…

94621
- 39
- 7
0
votes
0 answers
plot missing values hugh dataframe R
I have a huge dataframe (Fertig) with 815 variables and about 5000 observations.
One of the columns, $date contains years as values.
I would like to visualize missing values for the different variables in one year.
The following command…

Sulz
- 333
- 1
- 8
0
votes
2 answers
R is not detecting all the missing values with naniar package or colSums
The data I am working with is the Top 1000 IMDB movies from Kaggle (https://www.kaggle.com/harshitshankhdhar/imdb-dataset-of-top-1000-movies-and-tv-shows/download)
Here to demonstrate the problem I am considering the first 100 observations after…

Single Handed Sailor
- 59
- 9
0
votes
1 answer
recode_shadow for multiple variables using naniar
I am just starting in R and I came across this problem when trying to recode 88 to special missing value using naniar library.
Given this dataframe:
library(tidyverse)
df <- tibble::tribble(
~wind, ~temp, ~sun, ~test,
88, 45, 88, NA,
…

Duke Racoon
- 1
- 2
0
votes
1 answer
Group output from naniar using dplyr, nesting/unnesting, compatibility with newer version of R
I had a piece of R script running to get an overview on missing values in a repeated measures data frame. I used naniar and dplyr from the tidyverse and it worked fine. I used the combination to group the output by different factors (e.g. study,…

zaesa
- 1