######################################################################################################
# Create_the_Stringendo_Package.R
######################################################################################################
# file.edit("~/GitHub/Packages/Stringendo/Development/Create_the_Stringendo_Package.R")
# rm(list = ls(all.names = TRUE));
try(dev.off(), silent = TRUE)
devtools::load_all("~/GitHub/Packages/PackageTools/")
# Functions ------------------------
repository.dir <- "~/GitHub/Packages/Stringendo"
(package.name <- basename(repository.dir))
config.path <- file.path(repository.dir, "Development/config.R")
"TAKE A LOOK AT"
file.edit(config.path)
source(config.path)
# Install your package ------------------------------------------------
# install.packages('pracma')
# install.packages('stringdist')
# install.packages('ggExtra')
require(PackageTools)
PackageTools::document_and_create_package(repository.dir, config_file = 'config.R')
'git add commit push to remote'
# Install your package ------------------------------------------------
"disable rprofile by"
rprofile()
devtools::install_local(repository.dir, upgrade = F)
# Test if you can install from github ------------------------------------------------
remote.path <- file.path(DESCRIPTION$'github.user', DESCRIPTION$'package.name')
pak::pkg_install(remote.path)
# unload(DESCRIPTION$'package.name')
# require(DESCRIPTION$'package.name')
# # remove.packages(DESCRIPTION$'package.name')
# CMD CHECK ------------------------------------------------
devtools::check_man(repository.dir)
checkres <- devtools::check(repository.dir, cran = FALSE)
# Automated Codebase linting to tidyverse style ------------------------------------------------
styler::style_pkg(repository.dir)
# Extract package dependencies ------------------------------------------------
PackageTools::extract_package_dependencies(repository.dir)
# I have a list of functions where some are not properly separated at the bottom. Answer in text, not code.
# I need the following:
# 1. Generate a simple,unique, sorted list of function names, one function per line.
# 2. Identify the packages that contain these functions and provide a list of the corresponding packages for each function. Also make an R vector of the package names.
# 3. Acknowledge that some functions may not have an easily identifiable package.
# Visualize function dependencies within the package------------------------------------------------
{
warning("works only on the installed version of the package!")
pkgnet_result <- pkgnet::CreatePackageReport(DESCRIPTION$'package.name')
fun_graph <- pkgnet_result$FunctionReporter$pkg_graph$'igraph'
PackageTools::convert_igraph_to_mermaid(graph = fun_graph, openMermaid = T, copy_to_clipboard = T)
}
# Try to find and add missing @importFrom statements------------------------------------------------
devtools::load_all("~/GitHub/Packages/PackageTools/")
(ls.scripts.full.path <- list.files(file.path(repository.dir, "R"), full.names = T, pattern = '.R$'))
if (F) {
(excluded.packages <- unlist(strsplit(DESCRIPTION$'depends', split = ", ")))
for (scriptX in ls.scripts.full.path) {
PackageTools::add_importFrom_statements(scriptX, exclude_packages = excluded.packages)
}
}
# Generate the list of functions ------------------------------------------------
(ls.scripts.full.path <- list.files(file.path(repository.dir, "R"), full.names = T, pattern = '.R$'))
for (scriptX in ls.scripts.full.path) {
PackageTools::list_of_funs_to_markdown(scriptX)
}
file.edit(paste0(repository.dir, "R/list.of.functions.in.", package.name, ".det.md"))
file.edit(paste0(repository.dir, "README.md"))
file.remove(paste0(repository.dir, "/R/list.of.functions.in.", package.name, ".det.md"))
r$PackageTools()
PackageTools::copy_github_badge("active") # Add badge to readme via clipboard
file.edit(paste0(repository.dir, "README.md"))
# Replaces T with TRUE and F with FALSE ------------------------------------------------
(ls.scripts.full.path <- list.files(file.path(repository.dir, "R"), full.names = T, pattern = '.R$'))
for (scriptX in ls.scripts.full.path) {
PackageTools::replace_tf_with_true_false(scriptX)
PackageTools::replace_short_calls(scriptX)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.