est un langage de script orienté statistiques. C’est le langage préférés des archéologues1 qui utilisent des packages génériques comme ggplot pour les graphiques (développé par Hadley Wickham), terra et sf pour l’analyse spatiale, etc., ou d’autres plus spécialisés: nexus, tidyspec, etc.
“Anything that can be automated, should be automated” – Hadley Wickham, 2023 Wikipedia
Les packages R
rassemblent du code, de la documentation et parfois des données.
conçus pour être facilement partagé, installé et réutilisé et ainsi garantir la reproductibilité des analyses.
# MIT LicenseCopyright (c) 2025 IRAMAT-CNRSPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:(...)
#' Connect the CHIPS DB API and return an R object (dataframe, etc.)#'#' @name db_api_connect#' @description Connect the CHIPS DB API and return an R object (dataframe, etc.). The default dataset is dataset_adisser17, accessed at <http://157.136.252.188:3000/dataset_adisser17>#'#' @param d A hash object. If none is provided, a new one will be created.#' @param api_url An URL landing to an API. Default: 'dataset_adisser17'.#' @param output_format The selected output format. Default "dataframe".#' @param verbose if TRUE (by default), verbose.#'#' @return An R object.#'#' @examples#' df <- db_api_connect()#' # Show the first rows of the dataframe#' head(df$dataset_adisser17)#' #' @exportdb_api_connect <-function(d =NA,api_url ="http://157.136.252.188:3000/dataset_adisser17",output_format ="dataframe",verbose =TRUE){ (...) }
Le dossier inst/extdata/ contient les données externes
Le fichier NAMESPACE décrit quelles fonctions du package sont exportées.
# Generated by roxygen2: do not edit by handexport(chrono)export(db_api_connect)export(ppa)
Le dossier man/ contient la documentation des fonctions (générée depuis les fonctions elles-mêmes).
% Generated by roxygen2: do not edit by hand% Please edit documentation in R/ppa.R\name{ppa}\alias{ppa}\title{Classify a Point Pattern Distribution}\usage{ppa( d = NA, root = "https://raw.githubusercontent.com/iramat/iRamat/master/inst/extdata/", img.paths = c("clustered_distribution.png", "random_distribution.png", "regular_distribution.png"), ppa_tests = c("quadrat", "ripley", "gfunction"), verbose = TRUE)}(...)
Du code à la fonction, et de la fonction au package
# Generate 100 random numbers from a normal distributionx <-rnorm(100, mean =10, sd =2)# Compute the meanmean_x <-mean(x)# Print the resultcat("The mean of x is:", mean_x, "\n")
#' Compute the mean of random normal numbers#'#' This function generates `n` random numbers from a normal distribution#' with given `mean` and `sd`, then computes and prints their mean.#'#' @param n Integer, number of random values to generate.#' @param mean Numeric, the mean of the normal distribution.#' @param sd Numeric, the standard deviation of the normal distribution.#'#' @return The computed mean (numeric).#' @export#'#' @examples#' simulate_mean(100, mean = 10, sd = 2)simulate_mean <-function(n =100, mean =0, sd =1) { x <-rnorm(n, mean = mean, sd = sd) mean_x <-mean(x)cat("The mean of x is:", mean_x, "\n")return(mean_x)}
To cite package 'iRamat' in publications use:
Huet T (2025). _iRamat: Statistical analysis on Archaeomaterial_. R
package version 1.0.0, commit
2106b34129c6c9ab96d8e6302d807ab35f7ed13d,
<https://github.com/iramat/iRamat>.
A BibTeX entry for LaTeX users is
@Manual{,
title = {iRamat: Statistical analysis on Archaeomaterial},
author = {Thomas Huet},
year = {2025},
note = {R package version 1.0.0, commit 2106b34129c6c9ab96d8e6302d807ab35f7ed13d},
url = {https://github.com/iramat/iRamat},
}
Batist, Z. and Roe, J. 2024 Open Archaeology, Open Source? Collaborative practices in an emerging community of archaeological software engineers, Internet Archaeology 67. https://doi.org/10.11141/ia.67.13
Bommarito, E., & Bommarito II, M. J. (2021). An empirical analysis of the R package ecosystem. arXiv preprint arXiv:2102.09904.