[R] formula parsing, using parts ...

2003-10-27 Thread Russell Senior
I am writing a little abstraction for a series of tests. For example, I am running an anova and kruskal.test on a one-factor model. That isn't a particular problem, I have an interface like: my.function <- function(model,data) { print(deparse(substitute(data))) a <- anova(lm(formula,data

Re: [R] variance component analysis for nested model

2003-10-27 Thread Russell Senior
> "Pascal" == Pascal A Niklaus <[EMAIL PROTECTED]> writes: Pascal> lme should do the job (r1,r2,r3 are your random factors): Pascal> library(nlme) y.lme <- lme(y ~ 1,random = ~ 1 | r1/r2/r3) Pascal> summary(y.lme) Pascal> This is equivalent to a call to varcomp in S-Plus Thanks! This was th

[R] outer function problems

2003-10-27 Thread Scott Norton
I'm pulling my hair (and there's not much left!) on this one. Basically I'm not getting the same result t when I "step" through the program and evaluate each element separately than when I use the outer() function in the FindLikelihood() function below. Here's the functions: Dk<- function(x

RE: [R] stacking histograms

2003-10-27 Thread Liaw, Andy
The hist() function expects to be given data, not the counts in the bins. It sounded like you are giving hist() the counts. One thing you may try is by constructing an object of class "histogram" by hand (see the "Value" section of ?hist), and just plot() it. However, beware that by default hist(

[R] stacking histograms

2003-10-27 Thread Rajarshi Guha
Hi, I have a set of observations which are divided into two sets A and B. I have some code that bins the dataset into 10 bins based on the max and min of the observed values. I would like to make a histogram of A & B using my calculated bins but plot the distribution of B on top of A (like a st

[R] Error in validityMethod(object): No slot of name "phenoLabels" for this object o

2003-10-27 Thread Suresh Kumar Karanam
Hi, I was using the affy package in R for sometime. I reinstalled the R environment lately due to some other issues and now I get errors when I use the function ReadAffy. The error is reproduced here: Error in validityMethod(object): No slot of name "phenoLabels" for this object of class "pheno

Re: [R] New User Question regarding simulations

2003-10-27 Thread Jeff Laake
The book by Borcher's et al Estimating Animal Abundance provides R/S+ code that you may find useful for your work. Jeff Laake Bret Collier wrote: > > >R-Users, > > Everyone, I am a new user of R and I was wondering if anyone could point me > to a reference (book or article) that discusses writi

[R] New User Question regarding simulations

2003-10-27 Thread Bret Collier
R-Users, Everyone, I am a new user of R and I was wondering if anyone could point me to a reference (book or article) that discusses writing population simulations in R (or S). Thanks in advance, Bret A. Collier Arkansas Cooperative Fish and Wildlife Research Unit Department of Biological Scie

RE: [R] how to set missing values in R

2003-10-27 Thread RBaskin
One way: x<-c(1,3,-1,0,4) > x[x>0]<-NA > x [1] NA NA -1 0 NA > bob -Original Message- From: Yulei He [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 4:05 PM To: [EMAIL PROTECTED] Subject: [R] how to set missing values in R Hi, there. Can I ask how to set up missing values i

Re: [R] how to set missing values in R

2003-10-27 Thread James MacDonald
x[x>0] <- NA James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 >>> Yulei He <[EMAIL PROTECTED]> 10/27/03 04:05PM >>> Hi, there. Can I ask how to set up missing values in R? Suppose

Re: [R] how to set missing values in R

2003-10-27 Thread Douglas Bates
See the recent discussion about is.na() on this list. You can do what you want as > x<-c(1,3,-1,0,4) > is.na(x) = x > 0 > x [1] NA NA -1 0 NA Yulei He <[EMAIL PROTECTED]> writes: > Hi, there. > > Can I ask how to set up missing values in R? Suppose I want to assign the > missing value to the

[R] how to set missing values in R

2003-10-27 Thread Yulei He
Hi, there. Can I ask how to set up missing values in R? Suppose I want to assign the missing value to the elements in vector which is greater than zero like this: x<-c(1,3,-1,0,4); after the missing value assignment, x becomes (NA,NA,-1,0,NA). Thanks! Yulei $$

Re: [R] \mathcal symbols in R?

2003-10-27 Thread Paul Murrell
Hi Michael Grottke wrote: Hello, Some time ago, I discovered the possibility of using mathematical symbols for axis labels etc. In order ensure consistency between text and graphics of some paper, I would like to include the calligraphic H (obtained in LaTeX via \mathcal{H}) in several diagram

Re: [R] how to remove NaN columns ?

2003-10-27 Thread ryszard . czerminski
I received a lot of good advice how to remove NaN columns - thank you all !!! The simplest mechanism to center/scale and remove NaN columns seems to be > xdata <- data.frame(A = 3:1, B = 1:3, rep(9, 3)) > xs <- scale(xdata) > mask <- sapply(as.data.frame(xs), function(x) all(is.nan(x))) > scaled.

RE: [R] expanding factor with NA

2003-10-27 Thread Prof Brian Ripley
On Mon, 27 Oct 2003, Liaw, Andy wrote: > [OK, it's not so strange: na.action is not a documented argument for > model.matrix, and the call to model.frame in model.matrix.default does not > have ..., but shouldn't it?] o, as it documented as for arguments to other methods. -- Brian D. Ripley,

RE: [R] expanding factor with NA

2003-10-27 Thread Liaw, Andy
Strangely (to me), just passing na.action=na.pass to model.matrix doesn't work: > f <- factor(rep(letters[1:3], 5)) > is.na(f[sample(15, 3)]) <- TRUE > model.matrix(~f, data=model.frame(~f, na.action=na.pass)) (Intercept) fb fc 11 0 0 21 1 0 31 0 1 4

Re: [R] expanding factor with NA

2003-10-27 Thread Thomas W Blackwell
Perhaps a much simpler method (just thought of it) would be to set options(na.action="na.pass") before you start. Or use na.action=na.pass() as an argument in the call to model.frame(), since that's where the problem begins. See help("na.omit"), help("model.frame"). - tom blackwell - u

Re: [R] expanding factor with NA

2003-10-27 Thread Thomas W Blackwell
I would re-expand the model matrix by indexing its (nobs) rows with a longer vector (of length n) containing the correspondence. If there is only one term (say "Z") in the formula which contains the problematic NAs, I would do (roughly) ff <- Y ~ Z# following the example in ?model.m

Re: [R] problem using do.call and substitute for predict.glm using poly()

2003-10-27 Thread Gavin Simpson
Dear Thomas, Thank you for you reply and solution - it works perfectly! It hadn't occurred to me that a 1 column subset of a data frame was still a data frame and that therefore I didn't need to use data.frame() at all! To the list as well, please ignore my second mail on this thread. I was tr

Re: [R] problem using do.call and substitute for predict.glm using poly()

2003-10-27 Thread Gavin Simpson
Dear List, I think I have found the source of my problem in a reply from Thomas Lumley to a previous question on R-Help: http://www.r-project.org/nocvs/mail/r-help/2002/0586.html My code is not working because substitute() does not substitute formal arguments to functions, and I guess the firs

Re: [R] problem using do.call and substitute for predict.glm using poly()

2003-10-27 Thread Thomas Lumley
On Mon, 27 Oct 2003, Gavin Simpson wrote: > > But R throws up the following error: > > Error in poly(Alk1, degree = 2, coefs = structure(list(alpha = > c(37.7515662650602, : > Object "Alk1" not found > > When trying to evaluate the following code: > > pAsgn <- paste("predList[[i]][[n]] <

[R] expanding factor with NA

2003-10-27 Thread J.R. Lockwood
I have a factor (with "n" observations and "k" levels), with only "nobs" < n of the observations not missing. I would like to produce a (n x k) model matrix with treatment contrasts for this factor, with rows of NAs placeholding the missing observations. If I use model.matrix() I get back a (nobs

[R] Re: assign a constant to a different column for each row

2003-10-27 Thread uaca
Hi again Thanks all for your fast! reply regards Ulisses Debian GNU/Linux: a dream come true - "Computers are useless. They can only give answers."Pablo Picasso --->Visita http:

Re: [R] assign a constant to a different column for each row

2003-10-27 Thread Prof Brian Ripley
m[1:5 + nrow(m)*c(2,3,1,2,1)] <- 0 if m is a matrix. Remember you can index a matrix as a vector. If m is a data frame (you didn't say what it is) I would loop over columns (not rows) explicitly, since the code is going to do that implicitly. On Mon, 27 Oct 2003 [EMAIL PROTECTED] wrote: >

Re: [R] assign a constant to a different column for each row

2003-10-27 Thread M.Kondrin
[EMAIL PROTECTED] wrote: Hi all I want to assign a constant to a different column for each row eg: m[1,2] <- 0; m[2,3] <- 0; m[3,1] <- 0; m[4,2] <- 0; m[5,1] <- 0; ... etc... i've tried apply/tapply with no luck and also the following coefs <- rtt.abs[,5:8]; coefs.i <- coefs[] == 1;

[R] assign a constant to a different column for each row

2003-10-27 Thread uaca
Hi all I want to assign a constant to a different column for each row eg: m[1,2] <- 0; m[2,3] <- 0; m[3,1] <- 0; m[4,2] <- 0; m[5,1] <- 0; ... etc... i've tried apply/tapply with no luck and also the following coefs <- rtt.abs[,5:8]; coefs.i <- coefs[] == 1; coefs[coefs.i] <- 0;

RE: [R] how to select random rows ?

2003-10-27 Thread Henrik Bengtsson
rowIdx <- sample(nrow(a), size=nbrOfSamples) a[rowIdx,] and/or colIdx <- sample(ncol(a), size=nbrOfSamples) a[,colIdx] /Henrik Bengtsson > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: den 27 oktober 2003 16:26 > To:

Re: [R] neural networks

2003-10-27 Thread Pauline Gu
Thanks so much, Martin and Andy for your help. I understand it now. Pauline At 03:00 PM 10/25/2003 +0200, Martin Maechler wrote: > "Pauline" == Pauline Gu <[EMAIL PROTECTED]> > on Fri, 24 Oct 2003 10:03:23 -0700 writes: Pauline> Hello, experts, Does the number of input for Pa

[R] problem using do.call and substitute for predict.glm using poly()

2003-10-27 Thread Gavin Simpson
Hi I am having a particular problem with some glm models I am running. I have been adapting code from Bill Venables 'Programmers niche' in RNews Vol 2/2 to fit ca. 1000 glm models to a combination of species 0/1 data (as Y) and related physicochemical data (X), to automate the process of fitti

RE: [R] how to select random rows ?

2003-10-27 Thread Liaw, Andy
Like this: a.subset <- a[sample(nrow(a), how.many.I.want), ] HTH, Andy > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > Sent: Monday, October 27, 2003 10:26 AM > To: [EMAIL PROTECTED] > Subject: [R] how to select random rows ? > > > How can I select random

[R] how to select random rows ?

2003-10-27 Thread ryszard . czerminski
How can I select random subsets (rows!) from a data set ? If I generate simple data set > a <- data.frame(x=1:2, y = NaN, z = 2:1) > a x y z 1 1 NaN 2 2 2 NaN 1 I can select random subsets (colums) very easily using sample function: > sample(a, 2) z y 1 2 NaN 2 1 NaN I expected that us

Re: [R] Rpy Import Error

2003-10-27 Thread Dirk Eddelbuettel
On Mon, Oct 27, 2003 at 06:57:08AM -0800, Brett Magill wrote: > I am trying to install Rpy to test it out as an R > interface for a project that I am working on. > However, I get the following error. Any clues as to > what might be going on? I have alo tried RSPython, but > I gave up due to error

Re: [R] How can strheight be calculated in lattice/grid?

2003-10-27 Thread Deepayan Sarkar
On Monday 27 October 2003 03:50, Wolfram Fischer wrote: > If I have drawn a string with ``ltext( x, y, labels="first string" )'' > how can a draw a second string just one line (or strheight("X") > below the first string regardless of the size and scales of the panel? No reliable (that is, documen

[R] Starting and Terminating the JVM for package SJava

2003-10-27 Thread ZABALZA-MEZGHANI Isabelle
Hello, I would like to know if there is a possibility to open an R session via Java (using the SJava package), then to terminate it, and re-run another. It seems not to be possible. If this is the case, I would like to understand where is the problem or the limitation (is it due to the SJava imple

Re: [R] Lattice: no grid name space

2003-10-27 Thread Deepayan Sarkar
On Monday 27 October 2003 04:19, Prof Brian Ripley wrote: > On Mon, 27 Oct 2003, Edzer J. Pebesma wrote: > > The following now occurs to me when I try to > > > > load lattice (R 1.7.1, debian stable): > > > library(lattice) > > > > Error in loadNamespace(i, c(lib.loc, .libPaths()), keep.source) : >

[R] Rpy Import Error

2003-10-27 Thread Brett Magill
I am trying to install Rpy to test it out as an R interface for a project that I am working on. However, I get the following error. Any clues as to what might be going on? I have alo tried RSPython, but I gave up due to errors. RSPython segfaults when started from R and gives an error message I

Re: [R] Bioassays Yielding concentration-Mortality data

2003-10-27 Thread Thomas Lumley
On Mon, 27 Oct 2003, Ing. Michael Rost wrote: > Dear all, I'm trying reproduce an example of bioassays Yielding > Concentration-Mortality Data particularly control - adjustment model > from book Bioassay of Entomopathogenic Microbes and Nematodes chapter 7 > with R. > > I used glm with family=bino

Re: [R] commenting demos

2003-10-27 Thread Spencer Graves
Could one use "cat" for comments, as: cat("this is a comment that may survive 'source'\n") ?? hope this helps. spencer graves Martin Maechler wrote: "Olivia" == Olivia Lau <[EMAIL PROTECTED]> on Sun, 26 Oct 2003 00:49:45 -0400 writes: Olivia> Hi, Is there a way to make

Re: [R] commenting demos

2003-10-27 Thread Martin Maechler
> "Olivia" == Olivia Lau <[EMAIL PROTECTED]> > on Sun, 26 Oct 2003 00:49:45 -0400 writes: Olivia> Hi, Is there a way to make demo() print comments Olivia> along with the code and output? not so easily. The same applies to example(.). Both demo(.) and example(.) end up callin

[R] Bioassays Yielding concentration-Mortality data

2003-10-27 Thread Ing. Michael Rost
Dear all, I'm trying reproduce an example of bioassays Yielding Concentration-Mortality Data particularly control - adjustment model from book Bioassay of Entomopathogenic Microbes and Nematodes chapter 7 with R. I used glm with family=binomial and link=probit, but I do not know how to implement

AW: [R] Query: IRR Confidence Intervals

2003-10-27 Thread RINNER Heinrich
Hi Cristian, I don't know about a R routine for exact CIs, but I found a function called "ageadjust" using a gamma distribution approximation some time ago -take a look at http://medepi.org/epitools/rfunctions/index.html. That Webpage seems a bit outdated now, but the calculations given in the age

[R] Query: IRR Confidence Intervals

2003-10-27 Thread cristian
Does anybody know a R routine to calculate exact Confidence Intervals for Incidence Rate Ratio? Thanks Cristian - Biometria - biometria.univr.it __ [EMAIL PROTECTED] mailing list https://www.stat.math.e

[R] (on) first value from nlm (non-finit value supplied by nlm)

2003-10-27 Thread Thomas Bock
Dear R-helpers, if someone is interested in (last night I dreamed): ... SH <- -3.8 fn.2 <- function(p){ for (i1 in ilong){ ex[i1] <- (1E-19*p[1]*n*L*voigt(u,v,f[i1],foN,p[2],p[3])[[1]]) } sum((log(tt)-ex)^2) } out.2 <-nlm(fn.2, p = c(SH,GG,GL), hessian = TRUE, steptol = 1e-6,

[R] I am looking for the barplot version of histbackback( Hmisc library ) TIA

2003-10-27 Thread parrinel
__ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Re: [R] Oracle fetch problems

2003-10-27 Thread Prof Brian Ripley
Could you at least tell us which R package(s) and versions you are using here? You can access Oracle databases by ROracle and RODBC and perhaps other ways. If this is ROracle, it would be better to use the R-sig-DB list (see https://www.stat.math.ethz.ch/mailman/listinfo) or talk directly to the

Re: [R] using variables in obj$model

2003-10-27 Thread Prof Brian Ripley
Model frames do not contain interactions, they contain variables. `a:b' is not the name of a variable whereas A is. On Mon, 27 Oct 2003, Vito Muggeo wrote: > dear all, > for some reason I am intersted in updating a glm taking variables from its > model argument, namely: > > > dati<-data.frame(y=

[R] Oracle fetch problems

2003-10-27 Thread Joerg Schaber
relating to my former messages concerning the strange fetch problems I have, I found out that 'fetch' fetches only every second row of the 'native' SQL-results and fills up the rest of the rows with zeros. Here a draft for the native SQL-query: 12:43:07 SQL> SELECT OBS_DAY, OBS_YEAR, STAT_ID FR

[R] Whitehead's group sequential procedures

2003-10-27 Thread Emmanuel Charpentier
Dear List, I would like to know if there exist some R implementation of John Whitehead's procedures for the planning and analysis of group sequential clinical trials. His book is enlightenig but somewhat frustrating : it has a good basic exposition of his framework, but the technical details a

[R] using variables in obj$model

2003-10-27 Thread Vito Muggeo
dear all, for some reason I am intersted in updating a glm taking variables from its model argument, namely: > dati<-data.frame(y=runif(10),x=1:10) > obj<-glm(y~x,data=dati) > obj$model[,c("A","a:b")]<-cbind(rnorm(10),runif(10)) > names(obj$model) [1] "y" "x" "A" "a:b" > update(obj,.~.+A,dat

Re: [R] Lattice: no grid name space

2003-10-27 Thread Martin Maechler
> "Edzer" == Edzer J Pebesma <[EMAIL PROTECTED]> > on Mon, 27 Oct 2003 10:56:57 +0100 writes: Edzer> The following now occurs to me when I try to load Edzer> lattice (R 1.7.1, debian stable): >> library(lattice) Edzer> Error in loadNamespace(i, c(lib.loc, .libPaths()),

Re: [R] Lattice: no grid name space

2003-10-27 Thread Prof Brian Ripley
On Mon, 27 Oct 2003, Edzer J. Pebesma wrote: > The following now occurs to me when I try to > load lattice (R 1.7.1, debian stable): > > > library(lattice) > Error in loadNamespace(i, c(lib.loc, .libPaths()), keep.source) : > package `grid' does not have a name space > Error in library(la

Re: [R] Lattice: no grid name space

2003-10-27 Thread Uwe Ligges
Edzer J. Pebesma wrote: The following now occurs to me when I try to load lattice (R 1.7.1, debian stable): library(lattice) Error in loadNamespace(i, c(lib.loc, .libPaths()), keep.source) : package `grid' does not have a name space Error in library(lattice) : package/namespace load failed

[R] Lattice: no grid name space

2003-10-27 Thread Edzer J. Pebesma
The following now occurs to me when I try to load lattice (R 1.7.1, debian stable): library(lattice) Error in loadNamespace(i, c(lib.loc, .libPaths()), keep.source) : package `grid' does not have a name space Error in library(lattice) : package/namespace load failed I did an update.packages(

[R] How can strheight be calculated in lattice/grid?

2003-10-27 Thread Wolfram Fischer
If I have drawn a string with ``ltext( x, y, labels="first string" )'' how can a draw a second string just one line (or strheight("X") below the first string regardless of the size and scales of the panel? Thanks Wolfram __ [EMAIL PROTECTED] mailing lis

Re: [R] variance component analysis for nested model

2003-10-27 Thread Prof Brian Ripley
On 26 Oct 2003, Russell Senior wrote: > > Given a set of data: > > > names(data) > [1] "city" "house" "visit""value" > > I am looking for a way to compute the variance components of the > nested model (ie, visit 1 at house 2 at city 3 isn't related to visit > 1 and house 2 at city 4

Re: [R] variance component analysis for nested model

2003-10-27 Thread Pascal A. Niklaus
lme should do the job (r1,r2,r3 are your random factors): library(nlme) y.lme <- lme(y ~ 1,random = ~ 1 | r1/r2/r3) summary(y.lme) This is equivalent to a call to varcomp in S-Plus Pascal -- Dr. Pascal A. Niklaus Institute of Botany University of Basel Schönbeinstrasse 6 CH-4056 Basel

RE: [R] Difficulties with R.oo (static fields, etc.)

2003-10-27 Thread Henrik Bengtsson
This is not really an rhelp question. I'll get back to you later today with answers related to R.oo. Henrik Bengtsson The R.oo author > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Gabriel Baud-Bovy > Sent: den 27 oktober 2003 01:56 > To: [EMAI