| check.nomiss | R Documentation | 
Function that checks if a variable has no missing values for each subject.
check.nomiss(x, id, data, out=1)
x | 
 argument to specify the variable to check.  | 
id | 
 argument to specify a subject id variable.  | 
data | 
 optional data frame that contains the variables specified above.  | 
out | 
 either a string or an integer (  | 
The function checks if the values of a variable do not contain any missing values for each subject.
When out = 1 or out = "logical", the function simply returns a logical (i.e., TRUE or FALSE), depending on whether the variable contains no missing values within each subject.
When out = 2 or out = "id", the function returns a vector with the ids of those subjects where the variable contains missing values.
When out = 3 or out = "data", the function returns the data for those subjects where the variable contains missing values.
Wolfgang Viechtbauer wvb@wvbauer.com 
# illustrative dataset
dat <- data.frame(subj=rep(1:4, each=5),
                  obs = 1:5,
                  age = rep(c(20,31,27,22), each=5),
                  stress = c(2,3,1,4,2, 3,NA,3,3,3, 1,1,2,6,4, 1,2,1,3,1))
dat
# check if the age variable contains no missings
check.nomiss(age, subj, data=dat)
# check if the stress variable contains no missings
check.nomiss(stress, subj, data=dat)
# for which subjects are there missing values?
check.nomiss(stress, subj, data=dat, out=2)
# show the data for those subjects
check.nomiss(stress, subj, data=dat, out=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.