Skip to content

Commit

Permalink
Rel 0.7.2 - Added create_pdfs()
Browse files Browse the repository at this point in the history
  • Loading branch information
goedman committed Jul 30, 2022
1 parent 651eab0 commit 2a0ae8e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "RegressionAndOtherStories"
uuid = "21324389-b050-441a-ba7b-9a837781bda0"
authors = ["Rob J Goedman <[email protected]>"]
version = "0.7.1"
version = "0.7.2"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand All @@ -19,6 +19,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NamedArrays = "86f7a689-2022-50b4-a561-43c23ac3c673"
NamedTupleTools = "d9ec5142-1e00-5aa0-9d6a-321866360f50"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
PlutoPDF = "6eb38059-8c05-41f7-8871-5e7e2697ace6"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Expand All @@ -40,6 +41,7 @@ LaTeXStrings = "1.3"
NamedArrays = "0.9.6"
NamedTupleTools = "0.14"
Parameters = "0.12"
PlutoPDF = "0.1.4"
Reexport = "1.2.2"
Requires = "1.3"
StatsBase = "0.33.16"
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ RegressionAndOtherStories.jl contains supporting (Julia) functions and the data

The **supporting functions** are intended to be used in (currently) 2 Julia projects (also under development), [ROSStanPluto.jl](https://github.com/RegressionAndOtherStoriesJulia/ROSStanPluto.jl) and [ROSTuringPluto.jl](https://github.com/RegressionAndOtherStoriesJulia/ROSTuringPluto.jl).

I use the `ros_functions` dataframe to summarize all functions introduced in RegressionAndOtherStories.jl.

The `ros_functions` dataframe can be created in a notebook by executing `ros_functions = create_ros_functions()`.

As the actual available functions will vary by notebook there is a function `update_ros_functions(df)` which will update the `:function` column in `df` (typically `ros_functions`) for a given notebook based on its loaded packages (the dependency is shown in the column `:condition`).

All **data files** are in `.csv` format and located in the `data` directory.

If RegressionAndOtherStories.jl is loaded, the files can be read in as a DataFrame using:
Expand Down
26 changes: 26 additions & 0 deletions src/Maintenance/create_pdfs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import PlutoPDF

function create_pdfs(path::Union{AbstractString, Nothing}=nothing)
if path == nothing
@info "create_pdfs() expect a path to the notebook files."
return
end
if isdir(path)
cd(path)
end
files = readdir(path; join=true)
@info "Creating PDF file for:"
for file in files
if !(file[end-8:end] == ".DS_Store")
fin = split(file, '/')[end]
print(fin)
print(" => ")
fout = "../../pdfs/" * fin[1:end-3] * ".pdf"
println(fout)
PlutoPDF.pluto_to_pdf(fin, fout)
end
end
end

export
create_pdfs
2 changes: 1 addition & 1 deletion src/Maintenance/ros_notebooks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function add_to_ros_notebooks!(df, dir_path;
if isdir(f)
display_actions && println("Found dir $f")
add_to_ros_notebooks!(df, f)
elseif isfile(f)
elseif isfile(f) && f[end-2:end] == ".jl"
display_actions && println("Found notebook $f")
split_dir_path = split(f, "/")
parts = split_dir_path[end-1:end]
Expand Down
1 change: 1 addition & 0 deletions src/RegressionAndOtherStories.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ include("General/modelsummary.jl")
include("General/nested_columns.jl")
include("General/errorbars.jl")
include("Maintenance/ros_notebooks.jl")
include("Maintenance/create_pdfs.jl")

export
ROS,
Expand Down

0 comments on commit 2a0ae8e

Please sign in to comment.