[R] creating library

2008-05-29 Thread yoooooo
Hi, I'm able to create a library with R CMD INSTALL cmd, etc... I'm just wondering.. is it possible that when the user says library(boo), it runs some initialization code? I have a dumb R file that is: print(2) boo <- function(x){} when I R CMD INSTALL the library, I'm able to see 2

[R] logit newbie question...

2008-04-24 Thread yoooooo
Hi, I'm new to the glm and logit world... and I'm reading some lecture notes and examples. I would like to try and generate the same result in R.. but I don't seem to be able to find the proper way to specify the formula let's say i have Desire Using Drugs Not Using Drugs Yes

[R] Quickest way to access data.frame?

2008-04-02 Thread yoooooo
Hi, I have tried search around this forum for the best way to access a data.frame.. i got the feeling that "no partial match" is the way to make it fast so I convert everything to factor.. but I'm still not 100% sure if the following code will do it... is this the fastest way to do something f

Re: [R] cumsum list..

2008-03-14 Thread yoooooo
Yes! mapply is awesome! Thanks. Gabor Csardi wrote: > > cumsum( mapply(function(i,j) sum(a$data[i:j]), x, y) ) > > Is this what you want? > Gabor > > On Thu, Mar 13, 2008 at 06:02:13AM -0700, yoo wrote: >> >> Hi all, i have the following.. >&

[R] cumsum list..

2008-03-13 Thread yoooooo
Hi all, i have the following.. a <- data.frame(data = seq(1,10)) i have indices: x <- c(1, 5, 3, 9) y <- c(2, 7, 4, 10) I want the cumsum of a[1:2], a[5:7], a[3:4]... is there an elegant way to do it without any loop? Thanks! -- View this message in context: http://www.nabble.com/cumsum-l

[R] pipe scan timeout

2007-11-06 Thread yoooooo
Hi all, Usually when I do a command in shell and have the output read from R, I like to do this: pp <- pipe(cmd) sol <- scan(pp, what="character", sep="\n") I prefer this one over read.table since read.table somewhere has a gc call and it's slow. However, sometim

Re: [R] underdetermined system

2007-10-16 Thread yoooooo
MAIL PROTECTED] > > Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html > > > > > > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On > Behalf Of yoo > Sent: Tuesday, October 16, 2007 11:34 AM > To: r-

[R] underdetermined system

2007-10-16 Thread yoooooo
Hi, sorry, I'm an idiot.. and I know I'm missing something stupid.. I thought if we solve an underdetermine system with QR, my soln is: min ||x|| (L2 sense) such that Ax = b then say i have: > w <- matrix(c(1, 5), ncol=2) > sw = 2 > qrW = qr(t(w) %*% w) > qr.coef(qrW, t(w) %*% sw) [,1]

[R] as.POSIXlt, starting at 0 or 18000?

2007-09-11 Thread yoooooo
ss(strptime("1970-01-01", "%Y-%m-%d", tz="EST") + 0) unclass(strptime("1970-01-01", "%Y-%m-%d", tz="GMT") + 0) with LC_TIME=en_US; Or they always start from 18000? Thanks, - yoo -- View this message in context: http://ww