Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new whitespace-delimited example file and update examples for read_table() and melt_*() #1354

Merged
merged 11 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions R/melt_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@
#' @inheritParams read_table
#' @export
#' @examples
#' # One corner from http://www.masseyratings.com/cf/compare.htm
#' massey <- readr_example("massey-rating.txt")
#' cat(read_file(massey))
#' melt_table(massey)
#' fwf <- readr_example("fwf-sample.txt")
#' writeLines(read_lines(fwf))
#' melt_table(fwf)
#'
#' # Sample of 1978 fuel economy data from
#' # http://www.fueleconomy.gov/feg/epadata/78data.zip
#' epa <- readr_example("epa78.txt")
#' cat(read_file(epa))
#' melt_table(epa)
#' ws <- readr_example("whitespace-sample.txt")
#' writeLines(read_lines(ws))
#' melt_table2(ws)
melt_table <- function(file, locale = default_locale(), na = "NA", skip = 0,
n_max = Inf, guess_max = min(n_max, 1000),
progress = show_progress(), comment = "",
Expand Down
13 changes: 3 additions & 10 deletions R/read_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,9 @@
#' @inheritParams read_delim
#' @export
#' @examples
#' # One corner from http://www.masseyratings.com/cf/compare.htm
#' massey <- readr_example("massey-rating.txt")
#' cat(read_file(massey))
#' read_table(massey)
#'
#' # Sample of 1978 fuel economy data from
#' # http://www.fueleconomy.gov/feg/epadata/78data.zip
#' epa <- readr_example("epa78.txt")
#' cat(read_file(epa))
#' read_table(epa, col_names = FALSE)
#' ws <- readr_example("whitespace-sample.txt")
#' writeLines(read_lines(ws))
#' read_table(ws)

#' @rdname read_table
#' @export
Expand Down
4 changes: 4 additions & 0 deletions inst/extdata/whitespace-sample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
first last state phone
John Smith WA 418-Y11-4111
Mary Hartford CA 319-Z19-4341
Evan Nolan IL 219-532-c301
17 changes: 7 additions & 10 deletions man/melt_table.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 3 additions & 10 deletions man/read_table.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.