View source: R/dataframe_tools.R
rows_with_na | R Documentation |
It is sometimes useful to look at rows of a dataframe where a value is missing. For example, you may want to see why a function returns NA in some rows and not others.
rows_with_na(df)
df |
(Dataframe) The dataframe |
A dataframe with the same number of columns as df
, but the only
rows it has are rows that have at least 1 NA
value.
Desi Quintans (http://www.desiquintans.com)
na_starwars <- rows_with_na(dplyr::starwars)
dplyr::glimpse(na_starwars)
#> Observations: 58
#> Variables: 13
#> $ name <chr> "C-3PO", "R2-D2", "R5-D4", "Wilhuff Tarkin", "Greedo",...
#> $ height <int> 167, 96, 97, 180, 173, 175, 180, 66, 200, 150, NA, 160...
#> $ mass <dbl> 75, 32, 32, NA, 74, 1358, 110, 17, 140, NA, NA, 68, 89...
#> $ hair_color <chr> NA, NA, NA, "auburn, grey", NA, NA, "brown", "white", ...
#> $ skin_color <chr> "gold", "white, blue", "white, red", "fair", "green", ...
#> $ eye_color <chr> "yellow", "red", "red", "blue", "black", "orange", "bl...
#> $ birth_year <dbl> 112, 33, NA, 64, 44, 600, NA, 896, 15, 48, NA, NA, 92,...
#> $ gender <chr> NA, NA, NA, "male", "male", "hermaphrodite", "male", "...
#> $ homeworld <chr> "Tatooine", "Naboo", "Tatooine", "Eriadu", "Rodia", "N...
#> $ species <chr> "Droid", "Droid", "Droid", "Human", "Rodian", "Hutt", ...
#> $ films <list> [<"Attack of the Clones", "The Phantom Menace", "Reve...
#> $ vehicles <list> [<>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, "Tri...
#> $ starships <list> [<>, <>, <>, <>, <>, <>, "X-wing", <>, <>, <>, "A-win...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.