Re: [R] Using apply for two datasets

2009-01-06 Thread Satoshi Takahama
Perhaps you can convert your matrices to data frames as in: mapply(t.test,as.data.frame(myData1),as.data.frame(myData2)) to test by column and mapply(t.test,as.data.frame(t(myData1)),as.data.frame(t(myData2))) to test by row? - Original Message From: Gang Chen To: Henrique Dallazuan

Re: [R] Basic data structures

2008-08-10 Thread Satoshi Takahama
Suppose I want to have a regexp match against a string, and return all the matching substrings in a vector of strings. regexp <- "[ab]+" strlist <- c( "abc", "dbabddadd", "aaa" ) matches <- gregexpr(regexp,strlist) With this input, I'd want to return list( list("ab"), list("ab", "a"), li

Re: [R] how to replace NA values in a list

2008-08-01 Thread Satoshi Takahama
- Original Message From: Shang Liu <[EMAIL PROTECTED]> Subject: [R] how to replace NA values in a list I have a matrix named "spec" (see below), it is a 6x3 matrix, and each element of spec is a list. For example, spec[1,"wavenumber"] is a list, and it contains 1876 numeric numbers and

Re: [R] Best way to strsplit a column

2008-03-04 Thread Satoshi Takahama
Hi Daniel, After using strsplit() you can call a user-written function to extend the length of each list element to a uniform value and then use do.call() with rbind. For instance, > txt <- "1:2 + 3:4 + 5 + 6:7" > x<- readLines(textConnection(txt)) > > f <- function(x) + do.call(rbind, +

Re: [R] expand.grid function

2007-12-25 Thread Satoshi Takahama
Hi Derek, I love this function as well. If 'mat' is your matrix, > (mat <- matrix(1:15,ncol=3)) [,1] [,2] [,3] [1,]16 11 [2,]27 12 [3,]38 13 [4,]49 14 [5,]5 10 15 how about > expandedDF <- do.call(`expand.grid`,as.data.frame(mat)) > head(expand

Re: [R] R Compilation error on Ubuntu

2007-12-25 Thread Satoshi Takahama
Hi Taka, I was just trying to do this yesterday and ran into the same problem (compiling R 2.6.1 on Gutsy Gibbon). Apparently this happens on Debian/Ubuntu distributions because the developer install is separate from the user install. Basically, to address the configure error: "--with-readline