rappdirs v0.3.3

0

Monthly downloads

0th

Percentile

Application Directories: Determine Where to Save Data, Caches, and Logs

An easy way to determine which directories on the users computer you should use to save data, caches and logs. A port of Python's 'Appdirs' (<https://github.com/ActiveState/appdirs>) to R.

Readme

rappdirs

R-CMD-check CRAN
status

rappdirs is a port of appdirs to R. It lets you find the appropriate directory to save caches, logs, and data, on Linux, Mac, and Windows. It allows you to store files that need to shared across R sessions in a way that aligns with the CRAN policies.

Motivation

What directory should your app use for storing user data? If running on Mac OS X, you should use:

~/Library/Application Support/<AppName>

If on Windows (at least English Win XP) that should be:

C:\Documents and Settings\<User>\Application Data\Local Settings\<AppAuthor>\<AppName>

or possibly:

C:\Documents and Settings\<User>\Application Data\<AppAuthor>\<AppName>

for roaming profiles) but that is another story.

On Linux (and other Unices) the dir, according to the XDG spec (and subject to some interpretation), is either:

~/.config/<AppName>     

or possibly:

~/.local/share/<AppName>

Usage

This kind of thing is what rappdirs is for. rappdirs will help you choose an appropriate:

  • user data dir (user_data_dir())
  • user config dir (user_config_dir())
  • user cache dir (user_cache_dir())
  • site data dir (site_data_dir())
  • user log dir (user_log_dir())

For example, on Mac:

library(rappdirs)
appname <- "SuperApp"
appauthor <- "Acme"
user_config_dir(appname, appauthor)
#> [1] "~/Library/Application Support/SuperApp"
user_data_dir(appname, appauthor)
#> [1] "~/Library/Application Support/SuperApp"
site_data_dir(appname, appauthor)
#> [1] "/Library/Application Support/SuperApp"
user_cache_dir(appname, appauthor)
#> [1] "~/Library/Caches/SuperApp"
user_log_dir(appname, appauthor)
#> [1] "~/Library/Logs/SuperApp"

Functions in rappdirs

Name Description
user_cache_dir Path to user cache directory
site_data_dir Path to shared data/config directories
rappdirs-package rappdirs: Application Directories: Determine Where to Save Data, Caches, and Logs
user_log_dir Path to user log directory
user_data_dir Path to user config/data directories
app_dir Record app information in a convenient object
No Results!

Last month downloads

Details

Type Package
License MIT + file LICENSE
URL https://rappdirs.r-lib.org, https://github.com/r-lib/rappdirs
BugReports https://github.com/r-lib/rappdirs/issues
Copyright Original python appdirs module copyright (c) 2010 ActiveState Software Inc. R port copyright Hadley Wickham, RStudio. See file LICENSE for details.
Encoding UTF-8
RoxygenNote 7.1.1
Config/testthat/edition 3
NeedsCompilation yes
Packaged 2021-01-28 22:29:57 UTC; hadley
Repository CRAN
Date/Publication 2021-01-31 05:40:02 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/rappdirs)](http://www.rdocumentation.org/packages/rappdirs)