commit cb0a3f98154c270e99c6acbceb3651282e81a9ea
parent 70288b7c0467b9bb4efa1ef20687306445d42ed9
Author: Erik Loualiche <[email protected]>
Date: Tue, 20 May 2025 18:32:39 -0500
docstrings
Diffstat:
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
@@ -128,3 +128,4 @@ See my other package
- [BazerUtils.jl](https://github.com/eloualiche/BazerUtils.jl) which groups together data wrangling functions.
- [FinanceRoutines.jl](https://github.com/eloualiche/FinanceRoutines.jl) which is more focused and centered on working with financial data.
- [TigerFetch.jl](https://github.com/eloualiche/TigerFetch.jl) which simplifies downloading shape files from the Census.
+ - [Prototypes.jl](https://github.com/eloualiche/Prototypes.jl) which used to host all these functions
diff --git a/src/TimeShift.jl b/src/TimeShift.jl
@@ -38,10 +38,12 @@ backward in time by a specified amount `n`.
- If `n` has a type that doesn't match the difference type of `t_vec`
# Examples
-```julia
+```jldoctest
x = [1, 2, 3, 4, 5]
t = [Date(2023,1,1), Date(2023,1,2), Date(2023,1,3), Date(2023,1,4), Date(2023,1,5)]
tlag(x, t, n = Day(1)) # Returns: [missing, 1, 2, 3, 4]
+```
+
"""
function tlag(x, t_vec;
n = nothing,
@@ -135,10 +137,12 @@ forward in time by a specified amount `n`.
- If `n` has a type that doesn't match the difference type of `t_vec`
# Examples
-```julia
+```jldoctest
x = [1, 2, 3, 4, 5]
t = [Date(2023,1,1), Date(2023,1,2), Date(2023,1,3), Date(2023,1,4), Date(2023,1,5)]
tlead(x, t, n = Day(1)) # Returns: [2, 3, 4, 5, missing]
+```
+
"""
function tlead(x, t_vec;
n = nothing,
@@ -222,11 +226,12 @@ by a specified amount `n`. Acts as a unified interface to `tlag` and `tlead`.
- If `n` is not specified, issues a warning and defaults to a lag operation
# Examples
-```julia
+```jldoctest
x = [1, 2, 3, 4, 5]
t = [Date(2023,1,1), Date(2023,1,2), Date(2023,1,3), Date(2023,1,4), Date(2023,1,5)]
tshift(x, t, n = Day(1)) # Lag: [missing, 1, 2, 3, 4]
tshift(x, t, n = -Day(1)) # Lead: [2, 3, 4, 5, missing]
+```
See also: tlag, tlead
"""