Uncommon(?) Uses of Coding

JJ
Human in a Machine World
1 min readJul 22, 2016

I like programming. There are some great responses to “Why do some people like programming” on Quora.

Unfortunately, I’ve come to the conclusion that in my current position, programming will never be something I can do with a frequency that allows me to keep up to date on the syntax of even one modern language.

Short of finding another job, I am actively trying to find any excuse to open up RStudio to write a short script.

Today I needed a list of current accounts for a particular business segment in a table format (in Excel). Each account has its own folder titled with the account name in a shared directory. Here’s the short script I wrote to pull the folder names and drop the names of non-folder files (i.e. *.xlsx):

setwd("/somefolder")
fnames <- dir() # all file names in directory
id.excl <- grep("\\.", fnames) # ID of file names with "."
fnames[id.excl] # check files names to exclude
id.excl <- id.excl[-c(4,6,7)] # folder names with "." are okay
writeClipboard(fnames[-id.excl]) # write to clipboard

Excel monkey, not today!

--

--