Skip to content

Instantly share code, notes, and snippets.

View ccowens's full-sized avatar
💭
On

Charley Cowens ccowens

💭
On
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ccowens on github.
  • I am ccowens (https://keybase.io/ccowens) on keybase.
  • I have a public key ASC8m68oCREx1ll589hZipFE3q2G9A-r9SdyN8gE8d-I9go

To claim this, I am signing this object:

@ccowens
ccowens / convert-library-open-lines.R
Created September 5, 2018 21:44
#change library(pckg) copied lines to if(!require(pckg)) {install.packages("pckg"); library(pckg)} lines in clipboard
#change library(pckg) copied lines to if(!require(pckg)) {install.packages("pckg"); library(pckg)} lines in clipboard
writeLines(
unlist(
lapply(readLines(file("clipboard")),
function(x) {
x <- substr(x, nchar("library(")+1, nchar(x)-1)
paste0("if(!require(",x,")) {install.packages(\"",x,"\"); library(",x,")}") }
)), file("clipboard"))
closeAllConnections()