[R] Scoping rules

2003-10-08 Thread Peter Alspach
r(substitute(my.x)) to pass the name - but deparse(substitute(my.x)) also works. Is there any reason to prefer one over the other? Thank you ... Peter Alspach __ The contents of this e-mail are privileged and/or confidential to t

[R] Scoping Rules: Summary

2003-10-09 Thread Peter Alspach
rationale behind the choice of lexical scoping for R. Roger Peng showed how to modify fnB. Brian Ripley suggested that it is generally better to pass functions an object rather than just the name, and warned of the dangers of using get() on the result of deparse(substitute()). Thanks all Peter

[R] Standard errors from glm

2004-08-02 Thread Peter Alspach
(lm(S~rep+trt1*trt2*trt3, data=dummy.data), type='terms', se=T) or predict(glm(cbind(S, 100-S)~rep+trt1*trt2*trt3, data=dummy.data, family='binomial'), type='terms', se=T) or, as in my case, predict(glm(cbind(S, 100-S)~rep+trt1*trt2*trt3, data=dummy.data, family=

Re: [R] Standard errors from glm

2004-08-02 Thread Peter Alspach
ives the same standard errors as predict(temp.lm, se=T); i.e. those of the predicted values. Regards .... Peter Alspach >>> "Roger D. Peng" <[EMAIL PROTECTED]> 03/08/04 12:22:44 >>> Try summary(glm.object)$coefficients. -roger Peter Alspach wrote: > K

Re: [R] Standard errors from glm

2004-08-03 Thread Peter Alspach
$df [1] 23 $residual.scale [1] 14.59899 Whereas from the analysis of variance table we can get the standard error of the mean for trt1 as being sqrt(anova(temp.lm)[9,3]/12) = 4.214365. It is the equivalent of this latter value that I'm after in the glm() case. >>> Prof Brian Ri

Re: [R] Factor levels

2007-08-28 Thread Peter Alspach
k r s p l u z j x d q f Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Sébastien > Sent: Wednesday, 29 August 2007 9:00 a.m. > To: Gabor Grothendieck > Cc: R-help > Subject: Re: [R] Factor levels > >

Re: [R] simple predict question

2005-05-31 Thread Peter Alspach
2 3 4 5 6 7 8 9 10 11 0 2 4 6 8 10 12 14 16 18 20 Cheers . Peter Alspach >>> Gabor Grothendieck <[EMAIL PROTECTED]> 01/06/05 09:00:15 >>> On 5/31/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Excuse the simple question... > I'

Re: [R] superscript in figures - basic question

2005-06-13 Thread Peter Alspach
Ben Others have pointed out plotmath. However, for some superscripts (including 2) it may be easier to use the appropriate escape sequence (at in Windows): ylab = 'BA (m\262/ha)' Cheers .... Peter Alspach >>> "Benjamin M. Osborne" <[EMAIL PROTECTED]&g

Re: [R] confusing about contrasts concept

2006-08-16 Thread Peter Alspach
Tian Bill Venables wrote an excellent explanation to the S list back in 1997. I saved it as a pdf file and attach it herewith ... Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of T Mu > Sent: Thursday, 17 August 2

Re: [R] confusing about contrasts concept [long]

2006-08-16 Thread Peter Alspach
Tian It appears the attachment might not have worked so I'll embed Bill's message at the end. Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Peter Alspach > Sent: Thursday, 17 August 2006 8:02 a.m. > To: T

Re: [R] Moving plot labels

2007-04-04 Thread Peter Alspach
Dean Try: plot(c(-0.25,18),c(0, max(patient10)),type="n", ylab="SD of POST estimator", xlab="") title(xlab='Scans\n(a)', line=3) Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of [E

Re: [R] A particular shuffling on a vector

2007-04-19 Thread Peter Alspach
h(emmanuel), 1) if (startPos==1) newEmm else newEmm[c(startPos:length(newEmm),1:(startPos-1))] Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Emmanuel Levy > Sent: Friday, 20 April 2007 1:03 p.m. > To: r-help@stat.math.et

Re: [R] Special characters: plus/minus - a method that works

2006-03-20 Thread Peter Alspach
aechler wrote: >>>>>> "Peter" == Peter Alspach >>>>>> on Tue, 14 Jun 2005 14:11:47 +1200 writes: > > Peter> Ben > > Peter> Others have pointed out plotmath. However, for some > Peter> superscripts (including 2) it may be easier to use > P

Re: [R] factors and mca

2006-05-02 Thread Peter Alspach
Carlos ?mca states that mca works on a dataframe. As you've written it is.data.frame(de) returns FALSE Try de <- data.frame(d,e) instead of de <- factor(c(d,e)) HTH Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]

Re: [R] unbalanced design

2004-12-01 Thread Peter Alspach
but model.tables() still did not (but that could have been my error). However, se.contrast() worked. Cheers Peter Alspach >>> Damián Cirelli <[EMAIL PROTECTED]> 02/12/04 09:50:13 >>> Hi all, I'm new to R and have the following problem: I have a 2 factor des

Re: [R] dropping rows

2004-12-01 Thread Peter Alspach
Tobias I remember finding Patrick Burns' "S Poetry" (see http://www.burns-stat.com/ ) worth reading - and it covers this sort of thing nicely. Peter Alspach >>> Tobias Muhlhofer <[EMAIL PROTECTED]> 02/12/04 13:57:47 >>> Thanks. The problem is that the

[R] Positive log-likelihood in lme

2005-02-16 Thread Peter Alspach
ain that this question has been asked and answered recently. However, I can find no trace of it in the mail archives (although I have spent several hours reading lots of other interesting things :-)). Thanks ..... Peter Alspach __ The con

Re: [R] Adding up intervals by activity

2005-02-23 Thread Peter Alspach
Lorin You could use rle(): Say your Activity and Interval data is in lorin, then: tmp.rle <- rle(as.vector(lorin[,1]))[[1]] tapply(lorin[,2], rep(1:length(tmp.rle), tmp.rle), sum) 1 2 3 16 8 6 HTH Peter Alspach >>> Lorin Hochstein <[EMAIL PROTECTED]> 24/02/05 16:1

Re: [R] ifelse() question

2004-10-28 Thread Peter Alspach
at[dat[,4]=='POR',5] dat[,4] <- as.factor(dat[,4]) dat[,5] <- as.factor(dat[,5]) Peter Alspach >>> "F Z" <[EMAIL PROTECTED]> 29/10/04 12:48:54 >>> Hi I have a data.frame with dim = 18638 (rows) 6 (cols) names(dat) [1] "id"

Re: [R] as.list.matrix

2004-10-28 Thread Peter Alspach
Kjetil Isn't a data.frame as special type of list, and thus one could use as.data.frame? Peter Alspach >>> Kjetil Brinchmann Halvorsen <[EMAIL PROTECTED]> 29/10/04 14:16:03 >>> I found the need of converting a matrix into a list of its columns (for use with do.c

Re: [R] Aggregate to find majority level of a factor

2007-05-31 Thread Peter Alspach
Jon One way: assuming your data.frame is 'jon' aggregate(jon[,2], list(jon[,1]), function(x) levels(x)[which.max(table(x))]) Group.1 x 1 Plot1 big 2 Plot2 small 3 Plot3 small HTH .... Peter Alspach > -Original Message- > From: [EMAIL PROTECTED]

Re: [R] simple coding question

2007-07-30 Thread Peter Alspach
Kirsten One way to do this: kirsten <- c(123, 1234, 12345) 100*as.numeric(paste(substring(kirsten, 1, 3), substring(kirsten, 4, 5), sep='.')) HTH .... Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf O

Re: [R] identify selected substances across individuals

2007-01-21 Thread Peter Alspach
o do what I described above ? Use subsetting to identify that substances, and then !(...%in%...) to remove records with these substances: yourData[!(yourData$substance %in% yourData[yourData$id==3 & yourData$y>=4, 'substance']),] The above is untested and will need modif

Re: [R] If you had just one book on R to buy...

2007-02-25 Thread Peter Alspach
Julien This is quite a common question. Within R, try RSiteSearch('one good book for R') and follow the threads ...... Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Julien Barnier > Sent: Monday, 26

Re: [R] hwo can i get a vector that...

2007-03-07 Thread Peter Alspach
Check out which.max Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of bunny > , lautloscrew.com > Sent: Thursday, 8 March 2007 11:20 a.m. > To: R-help@stat.math.ethz.ch > Subject: Re: [R] hwo ca

Re: [R] How to choose columns in data.frame by parts of columns' names?

2006-05-30 Thread Peter Alspach
[1] "XG1" "YG1" "XEST" "YEST" "XNOEMP1" "XNOEMP2" [7] "YNOEMP1" "YNOEMP2" "XBUS10" "XBUS10A" "XBUS10B" "XBUS10C" [13] "YBUS10" "YBUS10A" &

Re: [R] barplot question

2006-10-17 Thread Peter Alspach
mes 90 > degrees, it would probably fit a lot more. Is this the sort of thing you mean: temp <- barplot(rnorm(16, 3)) text(temp, rep(-0.2, 16), paste('trt', 1:16), srt=90, adj=1) Peter Alspach > or maybe i can use space to make the horizontal width longer > ? I looed up

Re: [R] summary linear regression

2006-11-09 Thread Peter Alspach
Gorka See the message from Brian Ripley, which is the first item from RSiteSearch('R-squared') Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Gorka Merino > Sent: Friday, 10 November 2006 4:54 a.m. > To:

Re: [R] Creating a table

2006-11-14 Thread Peter Alspach
Michael One solution: df<-data.frame(loc=c("A","B","A","A","A"), year=c(1970,1970,1970,1976,1980)) df[,3] <- cut(df$year, c(1969.5,1974.5,1979.5,1984.5), c('1970-74','1975-79','1980-85')) with(df, ad

Re: [R] getting a title in a plot during an lapply

2006-11-16 Thread Peter Alspach
ude a title on each plot so that I can > recognize which plot goes with which decile but I don't know > how to do that basically because I can't figure out what > lapply is looping over by number. I definitely looked around > in various R books but I

Re: [R] making a grid of points

2006-12-07 Thread Peter Alspach
Ross I think you want ?expand.grid BTW, help.search('grid') finds this. Cheers ...... Peter Alspach > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Ross Boylan > Sent: Friday, 8 December 2006 8:03 a.m. > To: r-hel