[R] Sweave, using xtable in a loop doesnt work?

2009-04-02 Thread Stacey Burrows
I have a data.frame, data, with 30 factor variables. I would like to tabulate the frequencies of each variable and output to a tex file using Sweave. Here is my code chunk: <>= library(xtable) for(j in 1:30){   cap <- paste("Frequency counts for Q",j,".", sep="")   xtable(t(table(data[,j])),capt

[R] modifying patterns in a matrix

2008-09-17 Thread Stacey Burrows
Dear R-users, I have some very simple data where 1's represent events and zeroes non-events, e.g. temp <- rbind(c(0,1,0,0,1,1,1,0), c(0,0,0,1,0,0,0,0)) For each row in the matrix, I would like to replace a singelton event by a 0. That is, any 1 surrounded by zeroes (010) should be replaced by a

[R] reading in a subset of a large data set

2008-07-11 Thread Stacey Burrows
I have a huge dataset for which I only want to read in a subset of it. Is it possible to use read.table to read in only a subset of the data? For example, something like read.table('~/data.txt', subset = chromosome=='1' ) If not, then why not? This seems to be a feature available in all other s

[R] Extracting slots from ROCR prediction objects

2008-05-22 Thread Stacey Burrows
Hi, I have an object from the prediction function from the ROCR package and I would like to extract one of the slots from the object, for example the cutoffs slot. However the usual techniques ($, [["name"]]) of subsetting don't work. How can I assess the lists in the slots? Here is an example

[R] how to fit a model that is nonlinear with multiplicate errors

2008-04-10 Thread Stacey Burrows
Hi fellow R-users, I am interested in fitting the following model yi=log(a+xi*b*e), e~N(0,sigma2) and where x is a known covariate and a and b are parameters to be estimated as is sigma2. I am not sure how to fit such a model using lm or nls. Is there another function I can use to fit this?