Package 'readit'

Title: Effortlessly Read Any Rectangular Data
Description: Providing just one primary function, 'readit' uses a set of reasonable heuristics to apply the appropriate reader function to the given file path. As long as the data file has an extension, and the data is (or can be coerced to be) rectangular, readit() can probably read it.
Authors: Ryan Price [aut, cre]
Maintainer: Ryan Price <[email protected]>
License: MIT + file LICENSE
Version: 1.1.0
Built: 2024-11-13 03:28:14 UTC
Source: https://github.com/ryapric/readit

Help Index


Guess File Type to Pass to haven Readers

Description

This function is a helper for readit() to guess the type of file that can be passed to an appropriate reader from haven.

Usage

guess_haven(.data)

Arguments

.data

Data to guess/read

Value

A reader function, and its label


Guess ".txt" Delimiter

Description

Since a .txt file is of ambiguous delimitation, this function is a helper for readit() to guess the type, and return the appropriate reader.

Usage

guess_txt(.data)

Arguments

.data

Data to guess/read

Value

A reader function, and its label


Read Files of Any Type

Description

NOTE: the readit package is retired, and this function throws deprecation warnings when called. Please use the rio::import() function instead.

Usage

readit(.data, ..., tidyverse = TRUE)

Arguments

.data

File path to read data from.

...

Additional arguments passed to tidyverse read functions, e.g. sheet, n_max, etc.

tidyverse

Should readit use functions available in the tidyverse, e.g. functions from readr, etc.? Defaults to TRUE.

Details

Given a file path, read the data into R, regardless of file type/extension. readit is a thick wrapper around many of the tidyverse libraries, but can be forced to use base functions where possible. Note that the caveat is that the file needs to have an extension, as well as be of a relatively common type. "Common types" are any file type that can be handled by the readr, readxl, or haven packages.

Examples

readit(system.file("examples", "csv.csv", package = "readit"))
readit(system.file("examples", "tab_sep.txt", package = "readit"))
readit(system.file("examples", "semi_sep.txt", package = "readit"))
readit(system.file("examples", "xlsx.xlsx", package = "readit"))
readit(system.file("examples", "xls.xls", package = "readit"))
readit(system.file("examples", "iris.sas7bdat", package = "readit"))