{"id":16896130,"url":"https://github.com/teunbrand/datastamp","last_synced_at":"2025-12-04T23:30:14.718Z","repository":{"id":103975738,"uuid":"304337082","full_name":"teunbrand/datastamp","owner":"teunbrand","description":"R package for stamping data objects with metadata","archived":true,"fork":false,"pushed_at":"2020-10-19T08:49:48.000Z","size":51,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T10:44:09.357Z","etag":null,"topics":["logging"],"latest_commit_sha":null,"homepage":"https://teunbrand.github.io/datastamp/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/teunbrand.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-15T13:35:37.000Z","updated_at":"2024-07-07T13:19:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"516aa97f-ebfa-44ad-9793-fabcfb41ab9f","html_url":"https://github.com/teunbrand/datastamp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teunbrand%2Fdatastamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teunbrand%2Fdatastamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teunbrand%2Fdatastamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teunbrand%2Fdatastamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teunbrand","download_url":"https://codeload.github.com/teunbrand/datastamp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239658352,"owners_count":19675936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["logging"],"created_at":"2024-10-13T17:28:17.431Z","updated_at":"2025-12-04T23:30:14.676Z","avatar_url":"https://github.com/teunbrand.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# datastamp\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n[![Codecov test coverage](https://codecov.io/gh/teunbrand/datastamp/branch/master/graph/badge.svg)](https://codecov.io/gh/teunbrand/datastamp?branch=master)\n[![Travis build status](https://travis-ci.com/teunbrand/datastamp.svg?branch=master)](https://travis-ci.com/teunbrand/datastamp)\n\u003c!-- badges: end --\u003e\n\nThe goal of datastamp is to make it easy to attach some metadata to R objects. This can be convenient if you want to make `.RData` or `.rds` objects self-documenting, by attaching time of creation or the path to the script used to generate the data.\n\nThe package has basic functionality but isn't fine-tuned to handle any type of data one might want to document in R.\n\n## Installation\n\nYou can install the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"teunbrand/datastamp\")\n```\n\n## Example\n\nThis is a basic example which shows you how you would use the datastamp package at the end of an analysis.\n\n```{r example}\n# Library statements\nlibrary(datastamp)\n\n# Declare files\ninput_file  \u003c- system.file(\"extdata\", \"loremipsum.txt\", package = \"datastamp\")\noutput_file \u003c- tempfile(\"important_results\", fileext = \".rds\")\n\n# Load data\ndata \u003c- readLines(input_file)\n\n# Start very complicated analysis\nresult \u003c- toupper(data)\n\n# Saving results\nsaveRDS(\n  stamp(result, origin_files = input_file),  # \u003c-- Here be a datastamp!\n  file = output_file\n)\n```\n\nSo, imagine parking the project above for six months and you forgot some of the circumstances under which these files were created. Or, someone else send you this datastamped data, but you are unclear on the details. The datastamp package attaches some metadata to the R object that might help you remember.\n\n```{r}\nold_data \u003c- readRDS(output_file)\n\n# Who created this?\ninfo_user(old_data)\n\n# When was this object timestamped?\ninfo_time(old_data)\n\n# What script was used to generate the results?\n# The `basename()` is just so you don't have to see my messy folder structures!\nbasename(info_script(old_data))\n\n# What raw files went into these results?\nbasename(info_files(old_data))\n```\n\n## How does it work?\n\nWhen an object is stamped, a 'datastamp' attribute is attached to the object.\n\n```{r}\n# Printing atomic vectors report the datastamp attribute.\n(old_data)\n\n# You can explicitly retrieve the stamp with `get_stamp()`\nstamp \u003c- get_stamp(old_data)\n(names(stamp))\n\n# The stamp itself is also a list, so you can retrieve information by name\nstamp$time\n```\n\nIf you think some parts of the datastamp aren't necessary to include you can either set a global option or explicitly pass `FALSE` as argument for that part.\n\n```{r}\n# Via argument\n(get_stamp(stamp(1:5, session = FALSE)))\n\n# Via global options\noptions(\"datastamp.time\" = FALSE)\n(get_stamp(stamp(1:5)))\n```\n\n## Caveats\n\nIn interactive use, the current script can not be guessed with 100% accuracy, but it does a decent job in reporting 'console' or the currently active document in RStudio. This does not necessarily need to be the document where the data is stamped: if you have lengthy runtime on a chunk that contains `stamp()` and you switch document-tabs for example. It should pretty much do the right thing in non-interactive use though.\n\nFor the 'origin_files' argument, the stamping checks whether the files exist and reports the path with `normalizePath()`, which I think resolves symbolic links into absolute paths.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteunbrand%2Fdatastamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteunbrand%2Fdatastamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteunbrand%2Fdatastamp/lists"}