{"id":14066452,"url":"https://github.com/moodymudskipper/pkg","last_synced_at":"2025-04-12T20:52:12.451Z","repository":{"id":152320961,"uuid":"452803034","full_name":"moodymudskipper/pkg","owner":"moodymudskipper","description":"Package Objects","archived":false,"fork":false,"pushed_at":"2023-04-30T21:06:50.000Z","size":14,"stargazers_count":10,"open_issues_count":17,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T20:52:07.068Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moodymudskipper.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-01-27T18:43:56.000Z","updated_at":"2024-03-12T05:15:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"b6bfbaaf-51f6-4d2c-9c0d-b51396639bf4","html_url":"https://github.com/moodymudskipper/pkg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moodymudskipper%2Fpkg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moodymudskipper%2Fpkg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moodymudskipper%2Fpkg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moodymudskipper%2Fpkg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moodymudskipper","download_url":"https://codeload.github.com/moodymudskipper/pkg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631728,"owners_count":21136560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:05:06.382Z","updated_at":"2025-04-12T20:52:12.430Z","avatar_url":"https://github.com/moodymudskipper.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# pkg\n\npkgs and repos as R6 objects\n\n## examples\n\n```{r}\nlibrary(pkg)\n\n# create a new package, by default a temp dir is associated to it\n# with `p \u003c- Package$new(\".\")` you'll be working in your working directory and it\n# would fetch the package info from there\np \u003c- Package$new()\n\n# A print method summarizes the object\np\n\n# we can edit the description\np$DESCRIPTION$set(Package = \"math\", Title = \"Basic math\")\np\n\n# We can add functions using this idiom and create a function in its own script\n# no `p$add` element is actually created! instead `p$R$add.R` is created and populated\np$add \u003c- function(x, y) {x + y}\np$R$add.R\n\n# This script might be edited interactively\n# p$R$add.R$edit()\n\n# we can add to the script with this idiom\n# here again `p$R$add.R$subtract` is not created, but `p$R$add.R` is updated\np$R$add.R$subtract \u003c- function(x, y) {x - y}\np$R$add.R$foo \u003c- letters # we're not limited to functions\np$R$add.R\n\n# if the script doesn't already exist it's created\np$R$other.R$multiply \u003c- function(x, y) {x * y}\np$R$other.R\n\n# I can load the package already and use it as I would with devtools::load_all()\np$load()\nadd(1, 2)\n\n# the associated folder is not always in sync but now it is since we needed to dump to load\nlist.files(p$path, recursive = T)\n\n# We can dump manually as well\np$dump()\n\n# we also have repo objects, with methods that are essentially wrappers around {gert}\nglue_repo \u003c- Repo$new(\"https://github.com/tidyverse/glue\")\nglue_repo\n\nglue_repo$tag$list() |\u003e head(3)\n\n# we can pick a version and convert it to a package object\nglue_1.1.0 \u003c- glue_repo$tag$as_pkg(\"v1.1.0\")\n\nglue_1.1.0\n\n# we can load it and use it as if it was installed\nglue_1.1.0$load(export_all = FALSE, quiet = TRUE)\nglue(\"{letters[1:3]}!\")\n\n# both packages are there\nsearch()\n```\n\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoodymudskipper%2Fpkg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoodymudskipper%2Fpkg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoodymudskipper%2Fpkg/lists"}