Package {UlavalSSD}


Type: Package
Title: Quebec Data and Tools for Introductory Data Science
Version: 0.3.1
Description: Historical weather observations and food-establishment conviction records from Quebec for teaching data import, missing values, exploratory analysis and reproducible reporting. Includes bilingual prompts and feedback for a penguin data-cleaning exercise, and an optional static R code-style diagnostic based on 'lintr', as described by Hester and others (2025) <doi:10.21105/joss.07240>. Data are distributed as fixed teaching snapshots and require no network access during use.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Depends: R (≥ 4.1.0)
Suggests: knitr, lintr (≥ 3.4.0), rmarkdown, testthat (≥ 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
URL: https://github.com/AurelienNicosiaULaval/UlavalSSD
BugReports: https://github.com/AurelienNicosiaULaval/UlavalSSD/issues
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-09-22 21:32:52 UTC; runner
Author: Aurélien Nicosia [aut, cre]
Maintainer: Aurélien Nicosia <nicosia.aurelien@gmail.com>
Repository: CRAN
Date/Publication: 2026-10-02 11:10:02 UTC

UlavalSSD: Quebec Data and Introductory Data Science Tools

Description

Fixed weather and administrative-data snapshots for practising missing-value handling, exploratory analysis and reproducible reporting. Data and exercise prompts work offline with base R. The optional style diagnostic uses 'lintr'.

Author(s)

Maintainer: Aurélien Nicosia nicosia.aurelien@gmail.com

Authors:

See Also

MeteoQuebec, listecondamnation, consulter_taches(), verifier_valeur_aberrante(), eval_tidyverse_style()


Historical Daily Weather Observations from Quebec

Description

A fixed teaching snapshot of 20,111 daily records, from 1970-01-01 to 2025-01-22 inclusive. Missing observations are retained for data-cleaning exercises. Values, column order and original classes are preserved from version 0.2.1 for compatibility with existing course materials.

Usage

MeteoQuebec

Format

A data frame with classes spec_tbl_df, tbl_df, tbl, and data.frame, containing 20,111 rows and 11 columns:

...1

Numeric row identifier in the original export, not a weather measurement.

year

Year, numeric.

month

Month as a two-character string, "01" to "12".

day

Day as a two-character string, "01" to "31".

max_temp

Daily maximum temperature, degrees Celsius.

mean_temp

Daily mean temperature, degrees Celsius.

min_temp

Daily minimum temperature, degrees Celsius.

total_precip

Daily total precipitation, millimetres.

total_rain

Daily rainfall, millimetres.

total_snow

Daily snowfall, centimetres.

snow_grnd

Snow on the ground, centimetres.

All measurement columns are numeric and may contain NA. Dates have no gaps or duplicates, but this does not imply complete measurements.

Details

The original teaching snapshot was attributed to 'weathercan'. An independent reconstruction on 2026-09-22 matched all 11 columns, including missing values, using the ECCC GeoMet climate-daily service: station 5251 (climate identifier 7016294) through 1995-12-31, then station 26892 (701S001) from 1996-01-01. The original extraction date is unknown; the reconstruction and a source manifest are provided in the repository. It establishes the contents, not the homogeneity of the climate series. Station changes and missing observations require further assessment before trend estimation. Rain, snowfall and snow-depth measurements are missing for substantial portions of the series. There is no automatic refresh.

Source

Data source: Environment and Climate Change Canada (ECCC). Daily observations were independently retrieved and verified on 2026-09-22: https://api.weather.gc.ca/collections/climate-daily. Reproduced under the ECCC Data Services End-use Licence: https://eccc-msc.github.io/open-data/licence/readme_en/. The package is not endorsed by ECCC. See the installed COPYRIGHTS file.

Examples

weather <- as.data.frame(MeteoQuebec)
weather$date <- as.Date(with(weather, paste(year, month, day, sep = "-")))
range(weather$date)
colSums(is.na(weather))
head(weather[c("date", "min_temp", "max_temp")])

Prompts for a Penguin Data-Cleaning Exercise

Description

Retrieve one of four prompts used in the STT-1100 penguin exercise. French is the default to preserve existing course code.

Usage

consulter_taches(section, lang = "fr")

Arguments

section

One character string, exactly one of "histogramme", "nuage_de_points", "statistiques_descriptives", or "Visualisation_statistiques_descriptives" (case-sensitive).

lang

Message language: "fr" (default) or "en".

Value

A character string containing the exercise prompt.

Examples

consulter_taches("histogramme")
consulter_taches("statistiques_descriptives", lang = "en")

Static Style Feedback for R and Quarto Files

Description

Inspect R code without executing it, using a fixed set of 'lintr' checks. The result is a formative indicator, not a validated grade or a measure of statistical correctness. Project-specific '.lintr' settings are ignored.

Usage

eval_tidyverse_style(file_path)

Arguments

file_path

Path to an existing UTF-8 .R or .qmd file.

Details

Each of seven observable criteria receives 2 points if its linters report no issue and 0 otherwise. total rescales these points to 0–20. coherence and commentaires are always NA: meaningful comments and reasoning require human review. Empty, comment-only or syntactically invalid code receives NA for every score and for total.

In Quarto documents, only fenced R chunks are inspected. Backtick and tilde fences of at least three characters, with up to three leading spaces, are supported. Prose, inline R, chunk options and other languages are excluded. An unclosed R fence is an error. Diagnostic line numbers refer to the original file. Chunks are inspected statically even when eval: false.

The criteria cover indentation; operator, comma and parenthesis spacing; 80-character lines; assignment with ⁠<-⁠; snake-case object names; braces; and trailing whitespace and semicolons. A criterion with no applicable construct has no reported issue. The score therefore cannot compare the difficulty or completeness of different submissions.

Value

A list with scores (the nine named criteria retained from earlier versions), total, max_total (20), status ("ok", "empty", or "parse_error"), and diagnostics, a data frame of line, column, type, message and linter. The optional package 'lintr' must be installed.

References

Hester, J., Angly, F., Chirico, M., Hyde, R., Kun, R., Patil, I., and Rosenstock, A. (2025). Static Code Analysis for R. Journal of Open Source Software, 10(108), 7240. doi:10.21105/joss.07240.

Examples

if (requireNamespace("lintr", quietly = TRUE)) {
  path <- tempfile(fileext = ".R")
  writeLines(c("daily_mean <- mean(c(2, 4, 6))", "print(daily_mean)"), path)
  result <- eval_tidyverse_style(path)
  result$total
  unlink(path)
}

Historical Food-Establishment Conviction Records from Quebec

Description

A fixed teaching snapshot of 1,712 records published from 2023-02-13 to 2025-02-10. Original text fields, missing values and column order remain for exercises in importing, cleaning and summarising administrative data.

Usage

listecondamnation

Format

A data frame with classes tbl_df, tbl, and data.frame, containing 1,712 rows and 10 columns:

Nom_exploitant

Operator name, character.

Raison_sociale

Business name, character; may be missing.

Description_infraction

Description of the offence, character.

Adresse_lieu_infraction

Address of the offence, character.

Type_etablissement

Establishment type, character.

Date_infraction

Offence date, POSIXct in UTC.

Date_jugement

Judgment date, POSIXct in UTC.

Date_publication

Publication date, POSIXct in UTC.

Amende

Fine amount as originally formatted text, not numeric.

SOC_NOM_ARTCL_INFRC

Legislative reference, character; may be missing.

Details

Rows are records, not necessarily unique establishments. This historical extract is not an inventory of all establishments or inspections and cannot estimate the probability of an offence. It does not describe present-day operating conditions. No automatic update is performed. The maintainer confirms that all records originate from the official MAPAQ dataset. The original extraction date and preparation script are not recorded.

Source

Gouvernement du Quebec, Ministere de l'Agriculture, des Pecheries et de l'Alimentation (MAPAQ), via Donnees Quebec. The source catalogue lists the data under Creative Commons Attribution 4.0 International (CC BY 4.0). https://www.donneesquebec.ca/recherche/dataset/condamnations-des-etablissements-alimentaires-et-condamnations-concernant-le-bien-etre-des-anim. See the installed COPYRIGHTS file for attribution and provenance limits.

Examples

records <- as.data.frame(listecondamnation)
range(as.Date(records$Date_publication))
sort(table(records$Type_etablissement), decreasing = TRUE)

Answer-Key Feedback for the Penguin Exercise

Description

Return fixed feedback for the two deliberately altered rows in the course file manchots_donnees.xlsx (also named penguins_mission in exercises). This function does not inspect data or perform statistical outlier detection.

Usage

verifier_valeur_aberrante(ligne, lang = "fr")

Arguments

ligne

One finite positive whole number, giving the row in the original exercise file, before filtering or reordering.

lang

Message language: "fr" (default) or "en".

Details

The answer key corrects row 6 to a flipper length of 193 mm and row 11 to a body mass of 3300 g (3.3 kg) and a bill length of 37.8 mm. Feedback for any other row means only that it is absent from this answer key. It does not establish that an observation is statistically typical. The exercise file is distributed with the course, not with this package.

Value

A character string containing answer-key feedback.

Examples

verifier_valeur_aberrante(6)
verifier_valeur_aberrante(11, lang = "en")