{"action":"created","issue":{"url":"https://api.github.com/repos/bcgov/envreportutils/issues/10","repository_url":"https://api.github.com/repos/bcgov/envreportutils","labels_url":"https://api.github.com/repos/bcgov/envreportutils/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/bcgov/envreportutils/issues/10/comments","events_url":"https://api.github.com/repos/bcgov/envreportutils/issues/10/events","html_url":"https://github.com/bcgov/envreportutils/issues/10","id":238912077,"number":10,"title":"Split project generating tools into a new repo generalized to start an R project in bcgov repo","user":{"login":"boshek","id":18472598,"avatar_url":"https://avatars1.githubusercontent.com/u/18472598?v=3","gravatar_id":"","url":"https://api.github.com/users/boshek","html_url":"https://github.com/boshek","followers_url":"https://api.github.com/users/boshek/followers","following_url":"https://api.github.com/users/boshek/following{/other_user}","gists_url":"https://api.github.com/users/boshek/gists{/gist_id}","starred_url":"https://api.github.com/users/boshek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boshek/subscriptions","organizations_url":"https://api.github.com/users/boshek/orgs","repos_url":"https://api.github.com/users/boshek/repos","events_url":"https://api.github.com/users/boshek/events{/privacy}","received_events_url":"https://api.github.com/users/boshek/received_events","type":"User","site_admin":false},"labels":[{"id":203880695,"url":"https://api.github.com/repos/bcgov/envreportutils/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-27T16:37:04Z","updated_at":"2017-06-28T21:03:27Z","closed_at":null,"body":"- This package currently accomplishes two things: provide a series of ggplot2 utilities and provide some tools to generate a repo in line with bcgov and environmental reporting requirement\r\n- Should we consider creating splitting these into two repos? \r\n      - One repo could still contain the `ggplot2` utilities\r\n      - The other repo would be a \"one stop shop if you are looking to set up a repository and project for R in the bcgov\".\r\n-  Using the tools that you've already created here, one could imagine a function like this:\r\n```\r\nstart_project <- function(path = \".\", git_init = TRUE,\r\n                           rstudio = TRUE  ) {\r\n\r\n  if (path != \".\") dir.create(path, recursive = TRUE)\r\n\r\n  npath <- normalizePath(path, winslash = \"/\", mustWork = TRUE)\r\n\r\n  ## Need to check for analysis structure\r\n  dirs <- file.path(npath, c(\"data\", \"graphics\", \"R\",\"output\"))\r\n\r\n  Rfiles <- file.path(npath, c(\"set-up.R\"))\r\n\r\n  if (any(file.exists(dirs))) { ## file.exists is case-insensitive\r\n    #if (git) unlink(c(\".git\", \".gitignore\", recursive = TRUE, force = TRUE)\r\n    stop(\"It looks as though you already have an analysis set up here!\")\r\n  }\r\n\r\n  ## Add the necessary R files and directories\r\n  message(\"Creating new analysis in \", npath)\r\n  lapply(Rfiles, file.create)\r\n  lapply(dirs, dir.create)\r\n\r\n  if (rstudio) {\r\n    if (!length(list.files(npath, pattern = \"*.Rproj\", ignore.case = TRUE))) {\r\n      add_rproj(npath, paste0(basename(npath), \".Rproj\"))\r\n    } else {\r\n      warning(\"Rproj file already exists, so not adding a new one\")\r\n    }\r\n  }\r\n\r\n  if (git_init) {\r\n    if (file.exists(file.path(npath,\".git\"))) {\r\n      warning(\"This directory is already a git repository. Not creating a new one\")\r\n    } else {\r\n      git2r::init(npath)\r\n    }\r\n  }\r\n\r\n  if (git_init) {\r\n    write_gitignore(\".Rproj.user\", \".Rhistory\", \".RData\", \"data/\", \"output/\",\"graphics/\",\r\n                    \"set-up.R\", path = npath)\r\n  }\r\n  setwd(npath)\r\n  message(\"Setting working directory to \", npath)\r\n  invisible(npath)\r\n}\r\n```\r\n- This is adapted directly from the `analysis_skeleton()`. I'm not set on the name.\r\n- I have been using [this](https://bookdown.org/csgillespie/efficientR/set-up.html#project-management) rubric for setting up an analysis project though I am also not set on this approach. Just a start to the discussion.\r\n- I think that have a `package=TRUE` argument would make sense to set up along the lines or `devtools::create` and `devtools::setup`."},"comment":{"url":"https://api.github.com/repos/bcgov/envreportutils/issues/comments/311790095","html_url":"https://github.com/bcgov/envreportutils/issues/10#issuecomment-311790095","issue_url":"https://api.github.com/repos/bcgov/envreportutils/issues/10","id":311790095,"user":{"login":"stephhazlitt","id":7143861,"avatar_url":"https://avatars0.githubusercontent.com/u/7143861?v=3","gravatar_id":"","url":"https://api.github.com/users/stephhazlitt","html_url":"https://github.com/stephhazlitt","followers_url":"https://api.github.com/users/stephhazlitt/followers","following_url":"https://api.github.com/users/stephhazlitt/following{/other_user}","gists_url":"https://api.github.com/users/stephhazlitt/gists{/gist_id}","starred_url":"https://api.github.com/users/stephhazlitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephhazlitt/subscriptions","organizations_url":"https://api.github.com/users/stephhazlitt/orgs","repos_url":"https://api.github.com/users/stephhazlitt/repos","events_url":"https://api.github.com/users/stephhazlitt/events{/privacy}","received_events_url":"https://api.github.com/users/stephhazlitt/received_events","type":"User","site_admin":false},"created_at":"2017-06-28T21:03:27Z","updated_at":"2017-06-28T21:03:27Z","body":"I think this is a good idea -- the `bcgov-r-user` package could also include some of the RStudio add-in functions currently in `envreportutils` which would be useful for any bcgov R/RStudio user (e.g. using Apache, BCDEvEx badges). We would have to sit down and do some design work as some of the embedded arguments/options/functions are tailored for the EnvReportBC workflow."}}
{"actor":{"display_login":"stephhazlitt"}}