Skip to content

Commit

Permalink
add pkg install
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksanderbl29 committed Sep 23, 2024
1 parent 2b59f31 commit 5bc5044
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 6 deletions.
6 changes: 5 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ RoxygenNote: 7.3.2
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
Config/testthat/parallel: true
URL: http://package.aleksanderbl.dk/, https://github.com/aleksanderbl29/aleksandeR
BugReports: https://github.com/aleksanderbl29/aleksandeR/issues
Imports:
cli,
ggplot2 (>= 3.5.1),
ggthemes,
stringr
pak,
stringr,
usethis,
wesanderson
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(format_num)
export(install_basic_packages)
export(prepare_classes)
export(project_init)
export(theme_map)
Expand Down
42 changes: 40 additions & 2 deletions R/proj_init.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,49 @@ project_init <- function(packages = NULL) {
install.packages(c(
packages,
"tidyverse",
"marginaleffects",
"modelsummary",

"pak"
))
pak::pak("aleksanderbl29/dawaR")
# pak::pak("aleksanderbl29/aleksandeR")
pak::pak("gadenbuie/rsthemes")
}

#' @export
install_basic_packages <- function(additional_packages = NULL) {

# Vector of package names
packages <- c(
"tidyverse",
"marginaleffects",
"modelsummary",
"wesanderson",
"here",
additional_packages)

# Loop through the vector, check if installed, and install if missing
for (pkg in packages) {
if (!suppressPackageStartupMessages(require(pkg, character.only = TRUE))) {
cli::cli_alert_info("Installing {.var {pkg}}")
install.packages(pkg)
} else {
cli::cli_alert_success("{.var {pkg}} is already installed")
}
}

install.packages(
"rsthemes",
repos = c(
gadenbuie = 'https://gadenbuie.r-universe.dev',
getOption("repos"))
)

install.packages(
"dawaR",
repos = c(
"https://aleksanderbl29.r-universe.dev",
"https://cloud.r-project.org"
)
)

}
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ I currently don't have any functions in this category - But i plan to!

This package is built with the instructions from the great package-book [R Packages (2e)](https://r-pkgs.org).

I try to do test-driven development which was first introduced to me in the great video series by [Pat Schloss](https://www.schlosslab.org/labbies/schloss.html). Take a look if you're interested. [Video link](https://www.youtube.com/watch?v=TaNvqwMmHus)
For the themes I try to do test-driven development. It was first introduced to me in the great video series by [Pat Schloss](https://www.schlosslab.org/labbies/schloss.html). Take a look if you're interested. [Video link](https://www.youtube.com/watch?v=TaNvqwMmHus)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ I currently don’t have any functions in this category - But i plan to!
This package is built with the instructions from the great package-book
[R Packages (2e)](https://r-pkgs.org).

I try to do test-driven development which was first introduced to me in
the great video series by [Pat
For the themes I try to do test-driven development. It was first
introduced to me in the great video series by [Pat
Schloss](https://www.schlosslab.org/labbies/schloss.html). Take a look
if you’re interested. [Video
link](https://www.youtube.com/watch?v=TaNvqwMmHus)

0 comments on commit 5bc5044

Please sign in to comment.