Skip to contents

Read one or more files and combine them into a single data frame. If the result is invalid, the default stock data is returned

Usage

input_data(files, default_data = default_stock_data, combine = FALSE)

Arguments

files

A vector of file paths. The function only accepts CSV and Excel files.

default_data

The default data, included for testing purposes. It is not recommended to change this from its default.

combine

If TRUE, the resulting data frame will be combined with the default data frame.

Value

A tibble::tibble().

Examples

file <- tempfile(fileext = ".csv")
data <- tibble::tibble(
  x = 1:100,
  y = 100:1
)
vroom::vroom_write(data, file, ",")

input_data(file)
#> # A tibble: 100 × 2
#>        x     y
#>    <dbl> <dbl>
#>  1     1   100
#>  2     2    99
#>  3     3    98
#>  4     4    97
#>  5     5    96
#>  6     6    95
#>  7     7    94
#>  8     8    93
#>  9     9    92
#> 10    10    91
#> # … with 90 more rows