-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use renv * create targets pipeline * add example square plot to readme
- Loading branch information
1 parent
14d102d
commit 5597e15
Showing
14 changed files
with
1,891 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
source("renv/activate.R") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# more-maximal-room-squares | ||
|
||
An R6-based implementation of maximal partial Room squares | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Created by use_targets(). | ||
# Follow the comments below to fill in this target script. | ||
# Then follow the manual to check and run the pipeline: | ||
# https://books.ropensci.org/targets/walkthrough.html#inspect-the-pipeline | ||
|
||
# Load packages required to define the pipeline: | ||
library(targets) | ||
# library(tarchetypes) # Load other packages as needed. | ||
|
||
# Set target options: | ||
tar_option_set( | ||
packages = c("dplyr", "ggplot2", "purrr", "tibble") # packages that your targets need to run | ||
# format = "qs", # Optionally set the default storage format. qs is fast. | ||
# | ||
# For distributed computing in tar_make(), supply a {crew} controller | ||
# as discussed at https://books.ropensci.org/targets/crew.html. | ||
# Choose a controller that suits your needs. For example, the following | ||
# sets a controller with 2 workers which will run as local R processes: | ||
# | ||
# controller = crew::crew_controller_local(workers = 2) | ||
# | ||
# Alternatively, if you want workers to run on a high-performance computing | ||
# cluster, select a controller from the {crew.cluster} package. The following | ||
# example is a controller for Sun Grid Engine (SGE). | ||
# | ||
# controller = crew.cluster::crew_controller_sge( | ||
# workers = 50, | ||
# # Many clusters install R as an environment module, and you can load it | ||
# # with the script_lines argument. To select a specific verison of R, | ||
# # you may need to include a version string, e.g. "module load R/4.3.0". | ||
# # Check with your system administrator if you are unsure. | ||
# script_lines = "module load R" | ||
# ) | ||
# | ||
# Set other options as needed. | ||
) | ||
|
||
# tar_make_clustermq() is an older (pre-{crew}) way to do distributed computing | ||
# in {targets}, and its configuration for your machine is below. | ||
options(clustermq.scheduler = "multicore") | ||
|
||
# tar_make_future() is an older (pre-{crew}) way to do distributed computing | ||
# in {targets}, and its configuration for your machine is below. | ||
# Install packages {{future}}, {{future.callr}}, and {{future.batchtools}} to allow use_targets() to configure tar_make_future() options. | ||
|
||
# Run the R scripts in the R/ folder with your custom functions: | ||
tar_source() | ||
# source("other_functions.R") # Source other scripts as needed. | ||
|
||
# Replace the target list below with your own: | ||
list( | ||
tar_target( | ||
name = example_square, | ||
command = { | ||
n <- 10 | ||
r <- Room$new(size = n) | ||
for(e in r$empty_cells) { | ||
for(p in r$free_pairs) { | ||
if(r$is_available(e, p)) { | ||
r$set(e, p) | ||
break() | ||
} | ||
} | ||
} | ||
r | ||
} | ||
), | ||
tar_target( | ||
name = example_square_plot, | ||
command = { | ||
ggplot(data = example_square$cells, aes(col, row)) + | ||
geom_text(data = example_square$cells |> filter(!is.na(first)), aes(label = paste(first, second, sep = ","))) + | ||
geom_segment(data = grid_lines(9, 9), aes(x = x, y = y, xend = xend, yend = yend), linewidth = .1) + | ||
scale_y_reverse() + | ||
coord_fixed() + | ||
theme_void() + | ||
theme( | ||
legend.position = "none" | ||
) | ||
} | ||
), | ||
tar_target( | ||
name = save_example_square_plot, | ||
command = ggsave(plot = example_square_plot, filename = "img/example-square-plot.png", bg = "white", width = 1000, height = 1000, units = "px"), | ||
format = "file" | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* | ||
!.gitignore | ||
!meta | ||
meta/* | ||
!meta/meta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name|type|data|command|depend|seed|path|time|size|bytes|format|repository|iteration|parent|children|seconds|warnings|error | ||
.Random.seed|object|d08e111dcaf5a279||||||||||||||| | ||
all_ordered_pairs|function|fd70f8812a57f63a||||||||||||||| | ||
all_pairs|function|0122813d2df60f2b||||||||||||||| | ||
example_square|stem|6107fa208eea32d9|5b52292076fb2904|cee08d998dc990bd|-1152733714||t19707.7206536276s|b892e4e84b49c0f6|14617|rds|local|vector|||0.535|| | ||
example_square_plot|stem|b067304cb600fd20|784f26f64cc5c202|a1b5c3f1c80c0f35|1462431699||t19707.7261819609s|9b712a4d676df57c|125332|rds|local|vector|||0.083|| | ||
grid_lines|function|dda92efd0fc5213b||||||||||||||| | ||
horiz_lines|function|19853ce620c10b24||||||||||||||| | ||
is_subset|function|e65db254fe5dcf97||||||||||||||| | ||
remove_both|function|4179229d6b086fbb||||||||||||||| | ||
Room|object|4c37d216a4319bb8||||||||||||||| | ||
save_example_square_plot|stem|fa266ce9221b0107|0d1f713518cad50f|a3295d2826fb3f07|476347065|img/example-square-plot.png|t19707.7278283497s|28c7f87a4f688c71|31258|file|local|vector|||0.32|| | ||
vertical_lines|function|18ae0b56c415a8cd||||||||||||||| |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: Default | ||
SaveWorkspace: Default | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX |
Oops, something went wrong.