Re: [Rd] discrepancy between lm and MASS:rlm

2011-03-14 Thread Vadim Ogranovich
fit$contrasts <- attr(x, "contrasts") fit$xlevels <- .getXlevels(mt, mf) fit$na.action <- attr(mf, "na.action") if (model) fit$model <- mf if (!x.ret) fit$x <- NULL if (y.ret) fit$y <- y fit } -Original

[Rd] discrepancy between lm and MASS:rlm

2011-03-14 Thread Vadim Ogranovich
Dear R-devel, There seems to be a discrepancy in the order in which lm and rlm evaluate their arguments. This causes rlm to sometimes produce an error where lm is just fine. Here is a little script that illustrate the issue: > library(MASS) > ## create data > n <- 100 > dat <- data.frame(x=rep(

Re: [Rd] calling browser on error

2010-10-15 Thread Vadim Ogranovich
2 minor 9.1 year 2009 month 06 day26 svn rev48839 language R version.string R version 2.9.1 (2009-06-26) -Original Message- From: Joshua Ulrich [mailto:josh.m.ulr...@gmail.com] Sent: Friday, October 15, 2010 1:31 PM To: Vadim Ogranovich

[Rd] calling browser on error

2010-10-15 Thread Vadim Ogranovich
Dear R-developers, I am trying to figure out a way to call browser() when an error occur, and naturally I want the browser() to be called in the environment of the error. I tried something simple in vain: > f <- function() { x <- 1; stop('ok') } > tryCatch(f(), error=browser()) Called from: try

Re: [Rd] [R] converting result of substitute to 'ordidnary' expression

2010-06-26 Thread Vadim Ogranovich
Berry [mailto:cbe...@tajo.ucsd.edu] Sent: Friday, June 25, 2010 9:16 PM To: Vadim Ogranovich Cc: 'r-h...@r-project.org' Subject: Re: [R] converting result of substitute to 'ordidnary' expression On Fri, 25 Jun 2010, Vadim Ogranovich wrote: > Dear R users, > > >

[Rd] Save all objects in all environment stack

2009-09-14 Thread Vadim Ogranovich
Dear R Developers, I am writing a function that would save all objects in all environments 'visible' from the point where the function is called (very much like save.image, but kind of saving the entire stack). I figured that the call lapply (seq(0, sys.nframe()), function(i) ls(sys.frame(i), a

Re: [Rd] bug in approx crashes R

2009-07-28 Thread Vadim Ogranovich
Thank you Martin! The new 'rule'-s is exactly what I wanted. It's intuitive and consistent with the scalar use. Thanks, Vadim -Original Message- From: Martin Maechler [mailto:maech...@stat.math.ethz.ch] Sent: Tuesday, July 28, 2009 5:00 AM To: Vadim Ogranovich Cc: 

Re: [Rd] bug in approx crashes R

2009-07-27 Thread Vadim Ogranovich
. Still don't know how to do that. I agree that having a clear error message when yleft, yright, and f are set to non-scalars is better than silently returning NA. Thanks, Vadim -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Monday, July 27, 2009 12:14 PM

[Rd] bug in approx crashes R

2009-07-21 Thread Vadim Ogranovich
Dear R-devel, The following line crashes R > approx(1, 1, 0, method='const', rule=2, f=0, yleft=NULL, ties='ordered')$y Process R:2 exited abnormally with code 5 at Tue Jul 21 14:18:09 2009 > version _ platform i386-pc-mingw32 arch i386 os mingw32 syst

[Rd] building source package in R run within Emacs under Windows.

2009-07-21 Thread Vadim Ogranovich
Dear R-devel, I installed R-2.9.1 on the 'y:' drive which happens to be mounted to an IBRIX file system. I also downloaded and installed the Rtools bundle recommended for 2.9x. When I build a source package launching R via RGui.exe it seems to work fine: ## setting path according to "Appendix E

Re: [Rd] lsfit w/ rank-deficient x

2009-03-17 Thread Vadim Ogranovich
Actually, the correct permutation is given by the inverse of qr$pivot: foo$coefficients[foo$qr$pivot] <- foo$coefficients Here foo is an object returned by lsfit, see below. -Original Message- From: Vadim Ogranovich Sent: Friday, March 13, 2009 5:25 PM To: 'r-devel@r-pro

[Rd] lsfit w/ rank-deficient x

2009-03-13 Thread Vadim Ogranovich
Dear R-devel, It seems that lsfit incorrectly reports coefficients when the input matrix 'x' is rank-deficient, see the example below: ## here values of 'b' and 'c' are incorrectly swapped > x <- cbind(a=rnorm(100), b=0, c=rnorm(100)); y <- rnorm(100); lsfit(x, y)$coef Intercept a

[Rd] weekly update 20081208

2008-12-08 Thread Vadim Ogranovich
In Progress: * EURO DOLLAR data for trading Z* and vice versa * scripts for computing asset correlations w/ application to ED * improving R code for collecting stats accross dates and groups of data. Completed: * New signals for US Equity (based on PK alpha). Brandon will simulate and deploy if p

[Rd] names generated in list indexing

2008-11-28 Thread Vadim Ogranovich
Dear R-devel, When a character vector is used to subscript a list and when some of the subscripts are not present in the list names R returns NULL for those subscripts and generate NA names for each of them: > list(b=1)[c('a','b')] $ <<-- generated name NULL $b [1] 1 Wouldn't it be more int

[Rd] Rscript thank you

2007-12-19 Thread Vadim Ogranovich
Hi, I'd like to say thank you to the developers of Rscript. It is a nice tool that allows integration of R into multi-tool work flow and, in my experience so far, it does exactly what is expected of a utility program. Thank you very much! Vadim [[alternative HTML version deleted]]

[Rd] list.files() reorders files in R CMD INSALL

2005-06-23 Thread Vadim Ogranovich
Hi, The list.files() function seems to order its result vector differently when is run during R CMD INSTALL. Here is an example: ~% mkdir ~/FOO ~% cd ~/FOO/ ~/FOO% touch a A b B ~/FOO% ls a A b B Put foo.R in the vor package. The foo.R just prints the files in ~/FOO: print(list.files("~/F

Re: [Rd] efficiency of sample() with prob.

2005-06-21 Thread Vadim Ogranovich
In his "Introduction to Probability Models" Sheldon Ross describes (sec 11.4.1, 8th edition) the alias method for such weighted sampling. It is based on some decomposition of the original distribution (the weights) into a mixture of two-point distributions. I don't know the run-time complexity of t