Package 'qtkit'

Title: Quantitative Text Kit
Description: Support package for the textbook "An Introduction to Quantitative Text Analysis for Linguists: Reproducible Research using R" (Francom, 2024) <doi:10.4324/9781003393764> (available only after August 12, 2024). Includes functions to acquire, clean, and analyze text data as well as functions to document and share the results of text analysis. The package is designed to be used in conjunction with the book, but can also be used as a standalone package for text analysis.
Authors: Jerid Francom [aut, cre, cph]
Maintainer: Jerid Francom <[email protected]>
License: GPL (>= 3)
Version: 0.10.0
Built: 2024-06-16 04:26:24 UTC
Source: https://github.com/qtalr/qtkit

Help Index


Create data origin file

Description

Data frame with attributes about the data origin, written to a CSV file and optionally returned.

Usage

create_data_origin(file_path, return = FALSE, force = FALSE)

Arguments

file_path

File path where the data origin file should be saved.

return

Logical value indicating whether the data origin should be returned.

force

Logical value indicating whether to overwrite the file if it already exists.

Value

A data frame containing the data origin information.

Examples

tmp_file <- tempfile(fileext = ".csv")
create_data_origin(tmp_file)

Download an archive file and unarchive its contents

Description

Possible file types include .zip, .gz, .tar, and .tgz

Usage

get_archive_data(url, target_dir, force = FALSE, confirmed = FALSE)

Arguments

url

A character vector representing the full url to the compressed file

target_dir

The directory where the archive file should be downloaded

force

An optional argument which forcefully overwrites existing data

confirmed

If TRUE, the user has confirmed that they have permission to use the data. If FALSE, the function will prompt the user to confirm permission. Setting this to TRUE is useful for reproducible workflows.

Value

NULL, the archive file is unarchived in the target directory

Examples

test_dir <- file.path(tempdir(), "test")
url <- "https://raw.githubusercontent.com/qtalr/qtkit/main/inst/extdata/test_data.zip"
get_archive_data(
 url = url,
 target_dir = test_dir,
 confirmed = TRUE
)