{"id":14066425,"url":"https://github.com/oobianom/quickcode","last_synced_at":"2026-05-26T20:32:43.862Z","repository":{"id":176922319,"uuid":"659742392","full_name":"oobianom/quickcode","owner":"oobianom","description":"An R package made out of mine and Brice's scrapbook of much needed functions.","archived":false,"fork":false,"pushed_at":"2026-04-04T08:08:26.000Z","size":960,"stargazers_count":8,"open_issues_count":9,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-04T10:10:05.862Z","etag":null,"topics":["colors","cran","data","distributions","images","r"],"latest_commit_sha":null,"homepage":"https://quickcode.obi.obianom.com","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/oobianom.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-28T13:11:54.000Z","updated_at":"2026-04-04T08:08:29.000Z","dependencies_parsed_at":"2024-01-17T09:33:00.925Z","dependency_job_id":"0fd361a6-ef2f-47a9-9781-154f78a44beb","html_url":"https://github.com/oobianom/quickcode","commit_stats":null,"previous_names":["oobianom/quickcode"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/oobianom/quickcode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oobianom%2Fquickcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oobianom%2Fquickcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oobianom%2Fquickcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oobianom%2Fquickcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oobianom","download_url":"https://codeload.github.com/oobianom/quickcode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oobianom%2Fquickcode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33538659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["colors","cran","data","distributions","images","r"],"created_at":"2024-08-13T07:05:05.556Z","updated_at":"2026-05-26T20:32:43.856Z","avatar_url":"https://github.com/oobianom.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://quickcode.rpkg.net/logo57.png\" width=\"80\"\u003e\n\u003c/p\u003e\n\n# NOT functions, R tricks and a compilation of some miscellaneous codes to improve your R scripts\n\n## Official website: https://quickcode.obi.obianom.com ; https://quickcode.rpkg.net\n\n## NEW Function Documentation: https://quickcode.rpkg.net/reference/index2.html\n\n### R dependency: https://depends.rpkg.net/package/quickcode\n\n### Package stats: https://rpkg.net/package/quickcode \n\n### Author R scholar profile: https://scholar.rpkg.net/aut/obinna+obianom \n\n```\n# Install in R\ninstall.packages(\"quickcode\")\n```\n\n\n# 101+ great R functions to add to your scripts!\n\n## Featured function 1\n### Add one-line code in your R script to clear environment, clear console, set working directory and load files\n![](https://quickcode.obi.obianom.com/quickcode.png)\n\n\n## Featured function 2\n### Create a super variable with unique capability and wide scope\n![](https://quickcode.obi.obianom.com/quickcode2.png)\n\n## ✅ Some Quick R Examples\n\n***\n\n![](https://quickcode.obi.obianom.com/bionic_txt2.png)\n\n***\n\n\n```\n# Use the nullish coalescing operator using  \"or()\" or \"%or%\"\nex.V1 \u003c- 5\nex.V2 \u003c- NA\nex.V3 \u003c- NULL\nex.V4 \u003c- \"\"\nalternative \u003c- 500\n\n# Give an alternative result if the test is NULL NA or empty\n\nor(ex.V1,alternative) # result will give 5 because ex.V1 is not NULL NA or empty\n\nex.V1 %or% alternative # result will give 5 because ex.V1 is not NULL NA or empty\n\nex.V2 %or% alternative # result will give 500 because ex.V2 is NA\n\nex.V3 %or% alternative # result will give 500 because ex.V3 is NULL\n\nex.V4 %or% alternative # result will give 500 because ex.V4 is empty\n\n# Further chaining\n\nex.V2 %or% ex.V1 %or% alternative # result will be 5 because ex.V2 is NA but ex.V1 is 5\n\nex.V2 %or% ex.V3 %or% alternative # result will be 500 because ex.V2 is NA and ex.V3 is NULL\n\n```\n\n***\n\n```\n#load libraries and print names along with versions\n\nquickcode::libraryAll(\n  dplyr,\n  r2resize,\n  ggplot2\n)\n\n\n```\n***\n\n```\n#simple conversion between boolean types\n#input type is \"vector\"\nbaba \u003c- c(TRUE,\"y\",\"n\",\"YES\",\"yes\",FALSE,\"f\",\"F\",\"T\",\"t\")\nas.boolean(baba,1) # return vector as Yes/No\nas.boolean(baba,2) # return vector as TRUE/FALSE\nas.boolean(baba,3) # return vector as 1/0\n\n```\n***\n![](https://quickcode.obi.obianom.com/trimfile.gif)\n\n```\n#Recommended to use \"Addins\" in RStudio\n\n#Function call: Remove Empty Lines from a File\ntrim.file(\"path/to/your/file.txt\")\n\n```\n***\n\n```\n#Detect outliers in data by IQR and Zscore methods\nx \u003c- c(1, 2, 3, 4, 100)\ndetect_outlier(x, summary = TRUE)\ndetect_outlier(z, method = \"iqr\", multiplier = 3)\ndetect_outlier(y, method = \"zscore\", z_threshold = 2.5)\n\n```\n***\n\n```\n\n#apply the yesNoBool to convert between boolean\n#input type is \"data.frame\"\nusedata \u003c- data.frame(ID = number(32))\nusedata #view the dataset\n\nusedata$yess = rep(c(\"yes\",\"n\",\"no\",\"YES\",\"No\",\"NO\",\"yES\",\"Y\"),4) #create a new column\nusedata #view the modified dataset\n\n#set all yess field as standardize boolean\nyesNoBool(usedata,yess, type=\"bin\") #set all as binary 1/0\nyesNoBool(usedata,yess, type=\"log\") #set all as logical TRUE/FALSE\n\n```\n\n\n***\n\n```\n#initialize one or more variables\n\nprint(g) # Error: object 'g' not found\n\ninit(g,h,i,o)\nprint(g) # g = NULL\nprint(h) # h = NULL\n\ninit(r,y,u,b,value = 5)\nprint(r) # r = 5\nprint(b) # b = 5\nprint(z) # Error: object 'z' not found\n\n```\n\n***\n\n```\n#add keys to a vector content for use in downstream processes\n\nver1 \u003c- c(\"Test 1\",\"Test 2\",\"Test 3\")\nadd_key(ver1)\n\nfor(i in ver1){\nmessage(sprintf(\"%s is the key for this %s\", i$key, i$value))\n}\n\n```\n\n***\n\n```\n# Introducing the super variable\n# store dataset that should not be altered\nnewSuperVar(mtdf, value = austres) # create a super variable\nhead(mtdf) # view it\nmtdf.class # view the store class of the variable, it cannot be changed\n# it means that when the super variable is edited, the new value MUST have the same class\n\n# create and lock super variable by default\n# extra security to prevent changing\nnewSuperVar(mtdf3, value = beaver1, lock = TRUE)\nhead(mtdf3) # view\nmtdf3.round(1) # round to 1 decimal places\nhead(mtdf3) # view\nmtdf3.signif(2) # round to 2 significant digits\nhead(mtdf3) # view\n\n# Task: create a new super variable to store numbers\n# edit the numbers from various scopes\nnewSuperVar(edtvec, value = number(5))\nedtvec # view content of the vector\n\n# edtvec.set(letters) #ERROR: Cannot set to value with different class than initial value\n\nedtvec.set(number(20)) # set to new numbers\nedtvec # view output\n\nfor (pu in 1:8) {\n  print(edtvec) # view output within loop\n  edtvec.set(number(pu)) # set to new numbers within for loop\n}\n\nlc \u003c- lapply(1:8, function(pu) {\n  print(edtvec) # view output within loop\n  edtvec.set(number(pu)) # set to new numbers within lapply loop\n})\n\n# see that the above changed the super variable easily.\n# local variable will not be altered by the loop\n# example\nbim \u003c- 198\nlc \u003c- lapply(1:8, function(j) {\n  print(bim)\n  bim \u003c- j # will not alter the value of bim in next round\n})\n\n```\n\n***\n\n```\n\n#check if the entry is not integer\n\nnot.integer(45) #returns TRUE\nnot.integer(45.) #returns TRUE\nnot.integer(45L) #returns FALSE\n\nnot.null(45L) #returns TRUE\nnot.null(h\u003c-NULL) #returns FALSE\n\n\n```\n\n***\n\n```\n\n#clear R environment, set directory and load data\n#note: the code below also automatically loads the quickcode library so that all other functions within package can be used easily\n\n\nquickcode::refresh()\nquickcode::clean()\n\n#or combine with setwd and source and load\n\nquickcode::clean(\n  setwd = \"/wd/\",\n  source = c(\n  \"file.R\",\n  \"file2.R\"\n  ),\n  load = c(\n  \"data.RData\",\n  \"data2.RData\"\n  )\n)\n\n\n```\n\n***\n\n```\n\n#shorthand for not in vector\n\np1 \u003c- 4\np2 \u003c- c(1:10)\n\np1 %nin% p2\n\n\n\n```\n\n***\n\n```\n\n#add to a vector in one code\n\np1 \u003c- c(6,7,8)\np2 \u003c- c(1,2,3)\n\nvector_push(p1,p2)\n\nprint(p1)\n\n\n```\n\n***\n\n```\n\n#add to a data frame in one code\n\np1 \u003c- data.frame(ID=1:10,ID2=1:10)\np2 \u003c- data.frame(ID=11:20,ID2=21:30)\n\ndata_push(p1,p2,\"rows\")\n\nprint(p1)\n\n```\n\n***\n\n```\n\n#remove from a vector in one code\n\np1 \u003c- c(6,7,8,1,2,3)\n\nvector_pop(p1)\n\nprint(p1)\n\n\n```\n\n***\n\n```\n\n\n\n#remove from a data frame in one code\n\np1 \u003c- data.frame(ID=1:10,ID2=1:10,CD=11:20,BD=21:30)\n\ndata_pop(p1) #remove last row\n\nprint(p1)\n\ndata_pop(p1,5) #remove last 5 rows\n\nprint(p1)\n\n```\n\n***\n\n```\n\n\n#remove columns from a data frame in one code\n\np1 \u003c- data.frame(ID=1:10,ID2=1:10,ID4=1:10,CD=11:20,BD=21:30)\n\ndata_pop(p1,which = \"cols\") #remove last column\n\nprint(p1)\n\ndata_pop(p1,2,which = \"cols\") #remove last 2 columns\n\nprint(p1)\n\ndata_pop(p1,1,which = \"cols\") #remove last 1 column and vectorise\n\nprint(p1)\n\n```\n\n\n[![](https://quickcode.obi.obianom.com/writeit2.svg)](https://rpkg.net/package/quickcode)\n![](https://quickcode.obi.obianom.com/writeit0.gif)\n![](https://quickcode.obi.obianom.com/writeit2.gif)\n![](https://quickcode.obi.obianom.com/writeit3.gif)\n\n\n### And many more useful functions including list_shuffle, in.range ...\n\n###### By Obinna Obi Obianom, Creator of www.rpkg.net and www.shinyappstore.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foobianom%2Fquickcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foobianom%2Fquickcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foobianom%2Fquickcode/lists"}