Reputation: 583
I have a data frame
Id Name Affiliation
9 Ernest Jordan
14 K. MORIBE
15 D. Jakominich
25 William H. Nailon
37 P. B. Littlewood Cavendish Laboratory|Cambridge University
44 A. Kuroiwa Department of Molecular Biology|School of Science|Nagoya
75 M. Till-berg
I want to find out how many rows are there which are not complete ,ie having missing data.Like in this case rows with ID (9,14,15,25,75) have affiliations missing.So in this case the result should be 5.
I have tried
dim(author_data[complete.cases(author_data),])
But its not showing the correct result.Its giving output as
7 3
ie 7 rows and 3 columns
Thanks
Upvotes: 1
Views: 5566
Reputation: 1384
Given the data frame author_data, the code below will give you the number of rows with missing data.
sum(!complete.cases(author_data))
To view which rows have missing data
author_data[!complete.cases(author_data), ]
Upvotes: 8