An R interface to deweypy for downloading files from the Dewey file management system.
deweyr provides a simple way to download files from Dewey folders directly from R, without requiring manual Python environment setup. The package offers two download methods:
dewey_download()- Recommended method using UV (automatic Python environment management)dewey_download_py()- Traditional method using an existing Python installation
Install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("Coxabc/deweyr")The easiest way to get started - no Python installation required:
library(deweyr)
download_dewey(
api_key = "your-api-key",
folder_id = "your-folder-id"
)First-time setup: If UV isn't installed,
deweyrwill install it automatically. You may see a message recommending you restart your terminal for optimal performance in future runs.
If you already have Python and deweypy installed:
library(deweyr)
download_dewey_py(
api_key = "your-api-key",
folder_id = "your-folder-id"
)# Download to default location (./dewey-downloads)
download_dewey(
api_key = "your-api-key",
folder_id = "abc123"
)# Specify where to save files
download_dewey(
api_key = "your-api-key",
folder_id = "abc123",
download_path = "C:/Users/YourName/Documents/data"
)You can use either a folder ID or the full Dewey URL:
download_dewey(
api_key = "your-api-key",
folder_id = "https://api.deweydata.io/api/v1/external/data/abc123"
)Adjust the number of workers for faster downloads (default is 8):
download_dewey(
api_key = "your-api-key",
folder_id = "abc123",
num_workers = 16 # Use 16 parallel workers
)For datasets partitioned by date, you can filter which partitions to download:
# Download only data from 2024 onwards
download_dewey(
api_key = "your-api-key",
folder_id = "abc123",
partition_key_after = "2024-01-01"
)
# Download only data up to a certain date
download_dewey(
api_key = "your-api-key",
folder_id = "abc123",
partition_key_before = "2023-12-31"
)
# Download a specific date range
download_dewey(
api_key = "your-api-key",
folder_id = "abc123",
partition_key_after = "2024-01-01",
partition_key_before = "2024-03-31"
)download_dewey_duck(
api_key = "your-api-key",
data_id = "dataset-from-deweydata",
partition = "column-name-to-partition-by",
where = NULL,
select = NULL,
overwrite=FALSE
)read_dewey_duck(
path = "path-to-read-in-already-downloaded-data",
where = NULL
)get_dewey_urls_duck(
api_key = "your-api-key",
data_id = "dataset-from-deweydata",
preview = FALSE
)preview_dewey_duck(
api_key = "your-api-key",
data_id = "dataset-from-deweydata",
limit = 10,
where = NULL
)Note: This package requires an active Dewey account and API key. Visit Dewey to learn more.
