Posts filed under 'linux'

a nicer ls for R

R already has a function called ls(), which simply lists the names of all objects in the current environment, and ls.str(), which does so with a lot more information. I wanted one that looks a little more similar to ls -l in a Unix environment, so here’s a start:

my.ls <- function(envir = as.environment(-1)) {

       names <- .Internal(ls(envir, all.names=T))
       for (item in names) {

               l1 <- length(get(item))
               l2 <- ""
               if (!is.null(dim(get(item)))) {
                       l1 <- dim(get(item))[1]
                       l2 <- sprintf("%10d", dim(get(item))[2])
               }

               cat(sprintf("%-30s  %-10s  %-10s  %10d %10sn",
                       item, class(get(item)), mode(get(item)), l1, l2))
       }
}

Add comment April 29th, 2007

unix’ ubiquitousness

Finally finished reading The Practice of Programming. This presentation by one of the coauthors is kind of interesting / funny, about the good, bad, and ugly of Unix, one billion seconds after its creation. It is particularly interesting to read after the last chapter of their book.

Another interesting presentation by the same author describes how innovation is stiffled by Unix’s ubiquitousness. Quite interesting as well.

Add comment October 27th, 2006


Calendar

September 2008
M T W T F S S
« Aug    
1234567
891011121314
15161718192021
22232425262728
2930  

Posts by Month

Posts by Category