[R] Adjusting values via vectorization

2011-03-01 Thread Albert Vernon Smith
I'm adjusting values in a list based on a couple of matrixes. One matrix specifies the row to be taken from the adjustment matrix, while using the aligned column values. I have an approach which works, but I might find an approach with vectorization. Here is code with my solution: -- nids <

[R] Null values from DBI connection

2010-10-04 Thread Albert Vernon Smith
I am connecting to an Oracle database with RJDBC, and creating a data frame with dbGetQuery. When I get values return, values which are NULL in the database are being returned as 0 from my query. How can I have them returned as ? I am query like the following. -- require(RJDBC) drv <- JDBC

[R] missing values in 'ncdf', integer versus byte

2010-02-25 Thread Albert Vernon Smith
I'm working with the ncdf package, and I'm seeing a behavior which I am unsure whether it is a bug or a feature. I am creating a variable, which I make with the precision of "byte" and also set a missing value, When I put into this variable, all my NA values are put in properly as the missing val

[R] Iterating over file lines

2009-10-13 Thread Albert Vernon Smith
I am attempting to iterate over a file, processing it line by line. In my function below, I am only getting the first item over and over and over again from my test file rather than subsequent lines. How can I modify this to read lines sequentially? == iteratefile <- function(file) { f.con <-

[R] Clustering within part of a cluster result

2009-07-09 Thread Albert Vernon Smith
How can I cluster and order within part of a previous clustering result? For example, I am clustering and ordering results as follows: > rows <- 30 > cols <- 3 > x <- matrix(sample(-1:1,rows*cols,replace=T), nrow=rows, > ncol=cols,dimnames=list(c(paste("R",1:rows,sep="")),c(paste("C",1:cols,sep=