find_header | R Documentation |
Find the header row in a data.frame
find_header(dat, ...)
dat |
The input data.frame |
... |
See details |
If ...
is missing, then the first row with no missing values is used.
When searching for a specified value or value within a column, the first row
with a match will be returned, regardless of the completeness of the rest of
that row. If ...
has a single character argument, then the first
column is searched for that value. If ...
has a named numeric
argument, then the column whose position number matches the value of that
argument is searched for the name (see the last example below). If more than one
row is found matching a value that is searched for, the number of the first
matching row will be returned (with a warning).
The row number for the header row
Other Set names:
clean_names()
,
mu_to_u
,
row_to_names()
# the first row find_header(data.frame(A="B")) # the second row find_header(data.frame(A=c(NA, "B"))) # the second row since the first has an empty value find_header(data.frame(A=c(NA, "B"), B=c("C", "D"))) # The third row because the second column was searched for the text "E" find_header(data.frame(A=c(NA, "B", "C", "D"), B=c("C", "D", "E", "F")), "E"=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.