Archive for April, 2007

innocent

Last night I watched the movie Innocent by Simon Chung. These two reviews (1 & 2) give a much better description of the movie than I could do. The movie made a strange impact on me. The harsh environment of the main character is filmed extremely directly so the emotional impact of this movie is really strong, while at the same time this main character has a type of strong personality that really estranges him from me. Anyway, I’m not sure what to write about the movie, but I wanted to note it anyway.

Add comment April 29th, 2007

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


Calendar

April 2007
M T W T F S S
« Mar   May »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Posts by Month

Posts by Category