From 3f9e30ea4c20ee330432e1ffcafcab99e469e975 Mon Sep 17 00:00:00 2001 From: boB Rudis Date: Wed, 6 Mar 2019 07:57:26 -0500 Subject: [PATCH] as.data.frame, ... --- R/as-data-frame.R | 7 +++++-- man/as.data.frame.insensitive.Rd | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/R/as-data-frame.R b/R/as-data-frame.R index 56702bc..9a3a18e 100644 --- a/R/as-data-frame.R +++ b/R/as-data-frame.R @@ -3,16 +3,19 @@ #' @param x an object returned from a call to [httr::headers()]. This is #' a `list` classed as `insensitive` which is pretty generic but #' this method has a pretty thin use case and shouldn't cause issues. +#' @param row.names `NULL` or a character vector giving the row names for the +#' data frame. Missing values are not allowed. +#' @param optional ignored #' @param tbl if `TRUE` (the default) will class the output as a tibble #' @param ... ignored #' @param stringsAsFactors _always_ `FALSE` (unless you say otherwise) #' @export -as.data.frame.insensitive <- function(x, tbl=TRUE, ..., stringsAsFactors = FALSE) { +as.data.frame.insensitive <- function(x, row.names = NULL, optional = FALSE, tbl=TRUE, ..., stringsAsFactors = FALSE) { data.frame( name = names(x), value = unlist(x, use.names = FALSE), - row.names = NULL, + row.names = row.names, check.names = FALSE, stringsAsFactors = stringsAsFactors ) -> out diff --git a/man/as.data.frame.insensitive.Rd b/man/as.data.frame.insensitive.Rd index 5551765..c4feeeb 100644 --- a/man/as.data.frame.insensitive.Rd +++ b/man/as.data.frame.insensitive.Rd @@ -4,14 +4,19 @@ \alias{as.data.frame.insensitive} \title{Turn `httr::headers()`` objects into a data frame} \usage{ -\method{as.data.frame}{insensitive}(x, tbl = TRUE, ..., - stringsAsFactors = FALSE) +\method{as.data.frame}{insensitive}(x, row.names = NULL, + optional = FALSE, tbl = TRUE, ..., stringsAsFactors = FALSE) } \arguments{ \item{x}{an object returned from a call to \code{\link[httr:headers]{httr::headers()}}. This is a \code{list} classed as \code{insensitive} which is pretty generic but this method has a pretty thin use case and shouldn't cause issues.} +\item{row.names}{\code{NULL} or a character vector giving the row names for the +data frame. Missing values are not allowed.} + +\item{optional}{ignored} + \item{tbl}{if \code{TRUE} (the default) will class the output as a tibble} \item{...}{ignored}