Skip to content

Commit

Permalink
Automatic parsers for csv and tsv. Fixes #49
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Nov 29, 2013
1 parent 978e6be commit 1552484
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ httr 0.2.99
* httr now imports the methods package so that it works when called with
Rscript.

* New automatic parsers for mime types `text/tab-separated-values` and
`text/csv` (#49)

httr 0.2
-----------
Expand Down
6 changes: 6 additions & 0 deletions R/content-parse.r
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ parsers$`text/xml` <- function(x, ...) {
require("XML")
xmlParse(x, ...)
}
parsers$`text/csv` <- function(x, ...) {
read.csv(text = x, stringsAsFactors = FALSE, ...)
}
parsers$`text/tab-separated-values` <- function(x, ...) {
read.delim(text = x, stringsAsFactors = FALSE, ...)
}

parseability <- function(type) {
if (is.null(type)) return("raw")
Expand Down

0 comments on commit 1552484

Please sign in to comment.