βTime is not a line, but a dimension - where employment periods overlap, interweave, and transform into the tapestry of working life.β
An R package for temporal data analysis of employment records. The vecshift package transforms employment data with overlapping time periods into continuous temporal segments with employment status classifications.
Overview
The vecshift package provides efficient tools for processing employment/labor data stored in data.table format. It handles complex scenarios including:
- Multiple concurrent employment periods
- Employment gaps detection
- Part-time vs full-time classification
- Overlapping job periods
The main function vecshift() uses advanced data.table operations for efficient processing of large datasets.
Installation
From GitHub
# Install devtools if you haven't already
install.packages("devtools")
# Install vecshift from GitHub
devtools::install_github("gmontaletti/vecshift")Usage
library(vecshift)
library(data.table)
# Prepare your employment data
# Required columns: id, cf (fiscal code), INIZIO (start date), FINE (end date), prior (employment type)
employment_data <- data.table(
id = 1:3,
cf = c("ABC123", "ABC123", "DEF456"),
INIZIO = as.Date(c("2020-01-01", "2020-06-01", "2020-03-01")),
FINE = as.Date(c("2020-12-31", "2021-05-31", "2020-09-30")),
prior = c(1, 0, 1) # 0/-1 for part-time, positive for full-time
)
# Apply the vecshift transformation
result <- vecshift(employment_data)Output Format
The function returns a data.table with continuous temporal segments containing:
- periodo: Time period identifier
- cf: Fiscal code
- data_inizio: Segment start date
- data_fine: Segment end date
-
arco: Employment status classification
-
disoccupato: Unemployed periods -
occ_ft: Full-time employment -
occ_pt: Part-time employment -
over_*: Overlapping employment situations
-
Development
Dependencies
This package uses renv for dependency management. To set up the development environment:
# Restore project dependencies
renv::restore()
# After adding new dependencies
install.packages("new_package")
renv::snapshot()Citation
If you use vecshift in your research or publications, please cite it as follows:
# To get citation information in R:
citation("vecshift")BibTeX entry:
@Manual{vecshift2026,
title = {vecshift: Temporal Analysis of Employment Data with Event-Based Processing},
author = {Giampaolo Montaletti},
year = {2026},
note = {R package version 1.0.5},
url = {https://github.com/gmontaletti/vecshift},
doi = {10.5281/zenodo.XXXXXXX}
}APA format:
Montaletti, G. (2026). vecshift: Temporal Analysis of Employment Data with Event-Based Processing (Version 1.0.5) [Computer software]. https://github.com/gmontaletti/vecshift
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Author
Giampaolo Montaletti
π§ giampaolo.montaletti@gmail.com
π GitHub
π ORCID: 0009-0002-5327-1122
Issues
If you encounter any problems or have suggestions, please file an issue at https://github.com/gmontaletti/vecshift/issues