[R] aggregating data and missing values

2005-11-02 Thread Pascal A. Niklaus
Hi all, I would like to aggregate a large data file that is defined by a number of factors and associated values. The point is that not all factor level combinations are present in the data file -- these missing values are in fact to be treated as zeroes. Is there a straightforward way to

[R] lines in 3d-cloud plot (lattice)

2004-01-30 Thread Pascal A. Niklaus
Hi all, I'd like to plot a set of data (x,y,z) as 3D-cloud, and add several line plots to the same 3D graph: Two questions: 1) How do I connect points to get a line? cloud(z~x*y,data=d,zlim=c(0,1))# works cloud(z~x*predict(l),data=d,zlim=c(0,1),type=l) # type=l doesn't Warning

[R] error message in plot(aov-object) -- repost

2004-01-16 Thread Pascal A. Niklaus
Hi all, I posted this question several days ago, but did not get any answer until now. Since I still have no clue about the source of this error message, I repost a description of the problem including some code: A student at our institute fitted an aov model, and got the following error

[R] error message in plot(aov-object)

2004-01-14 Thread Pascal A. Niklaus
Hi all, A student at our institute asked me for help with the following problem: After fitting an aov model, she wanted diagnostic plots, and got the following error message: plot(p.aov) Hit Return to see next plot: Hit Return to see next plot: Error in plot.window(xlim, ylim, log, asp, ...)

[R] ESS tab completion for file names

2003-12-18 Thread Pascal A. Niklaus
Hi all, Using Xemacs/ESS (Xemacs 21.4-12/ESS 5.1.24), I noticed that tab completion does not work for file names. df - read.csv(xx [TAB] doesn't complete the file name. After hitting TAB, I get last thing matched was not a buffer in the status bar. Any idea what may go wrong? Thanks for

Re: [R] ESS tab completion for file names

2003-12-18 Thread Pascal A. Niklaus
Sean Davis wrote: I don't think that this works within the R process buffer, but I could be wrong. Does the documentation say that it should somewhere? Sean The ESS doc says (section 3.2): Completion is also provided over file names, which is particularly useful when using S functions such

[R] prevent aov re-ordering of model terms

2003-12-18 Thread Pascal A. Niklaus
Is there a way to prevent the re-ordering of factors by aov? I do have a three-way interaction that I do want to fit before a two-way interaction (different factors, so they are not nested), but R moves the two-way interaction to the front. I know it generally makes sense to fit the two-way

Re: [R] variance estimates in lme biased?

2003-12-17 Thread Pascal A. Niklaus
Running lme on your data set results exactly in what you expect - or do you expect something different? Pascal L1-factor(F1f) L2-factor(F2f) L3-factor(F3f) lme(value ~ 1,random = ~ 1 | L1/L2/L3) Linear mixed-effects model fit by REML Data: NULL Log-restricted-likelihood: 438.9476 Fixed:

[R] Session log file...

2003-12-17 Thread Pascal A. Niklaus
Hi all, I tried to save a complete log of a R session we had in a seminar today... but I didn't succeed. 1) R | tee session.log This saves both input and output, but I do get the cursor key escape sequences from editing (cursor-up to get last command etc) instead of the actual command line

Re: [R] mailing list for basic questions - preliminary sum up

2003-12-16 Thread Pascal A. Niklaus
Martin Wegmann wrote: Dear R-user, I already received quite a lot of replies to this mail and like to do a preliminary sum up. A few were sceptical about the use of such a beginner mailing list. The arguments were that people starting with R will only stay subscribed for a short time

[R] Add row to data frame

2003-12-08 Thread Pascal A. Niklaus
Hi all, is there an easy way to build up a data frame by sequentially adding individual rows? The data frame consists of numeric and character columns. I thought of rbind, but I ended up with numeric values for the character columns. Pascal __

Re: [R] Add row to data frame

2003-12-08 Thread Pascal A. Niklaus
Martin Maechler wrote: Pascal == Pascal A Niklaus [EMAIL PROTECTED] on Mon, 08 Dec 2003 11:47:02 +0100 writes: Pascal Hi all, is there an easy way to build up a data Pascal frame by sequentially adding individual rows? yes, pretty easy, but usually not recommended because

Re: [R] lme: reproducing example

2003-12-02 Thread Pascal A. Niklaus
Karl Knoblick wrote: Dear R-community! I still have the problem reproducing the following example using lme. id-factor(rep(rep(1:5,rep(3,5)),3)) factA - factor(rep(c(a1,a2,a3),rep(15,3))) factB - factor(rep(c(B1,B2,B3),15)) Y-numeric(length=45) Y[ 1: 9]-c(56,52,48,57,54,46,55,51,51)

Re: [R] Indexing ANOVA table

2003-12-01 Thread Pascal A. Niklaus
Prof Brian Ripley wrote: On Sat, 29 Nov 2003 [EMAIL PROTECTED] wrote: Hi all, I'd like to extract a value from an ANOVA table, but experience the following problem: ### This works: s.pseudo - summary(aov(m ~ block + mix*graz,data=split1)) s.pseudo Df Sum Sq Mean Sq F

[R] plot map of areas

2003-11-21 Thread Pascal A. Niklaus
Hi all, Given a number of points (x,y) in a plane, I'd like to plot a map of polygons, so that 1) each polygon contains exactly one point 2) the polygon defines the area for which this specific point is closer than any other point. It's a bit like a map of areas influenced by that

[R] Find value in vector (or matrix)

2003-11-20 Thread Pascal A. Niklaus
Hi all, Is there a function to check if a particular value is contained in a vector? I've looked at grep in the hope that I could use a Perl-like syntax, but obviously it's different... I'd like to do something like: y - c(a,b,c) if(a in y) { # a is not in y } Also, is

[R] Increment element of vector and efficiency

2003-11-20 Thread Pascal A. Niklaus
Hi all, Thanks for the incredibly quick help with the %in%... There's a second question, though: I'd like to increment an element of a vector if a certain event occurs, e.g. count[event] - count[event] + 1; # works, but... Is this efficient? I wonder whether R needs to subset the

[R] postscript device: horizontal=F

2003-11-13 Thread Pascal A. Niklaus
The postscript device behaves strangely - is this possibly a bug? case 1) postscript(gfx-%d.ps,width=8 , height=5, paper=special, horizontal=F, onefile=FALSE); some plots here dev.off() The first plot is in portrait orientation The second and all the following plots are in landscape

Re: [R] Hierarchical glm - Followup

2003-11-07 Thread Pascal A. Niklaus
Pascal A. Niklaus wrote: Hi all, I'm not sure how to correctly analyse the following data with glm, and hope for some advice from this list, ideally showing how to specify the model in R and perform the tests, and also for suggestions of literature. The data structure is like this: - 20

Re: [R] Absolut newbie questions

2003-11-06 Thread Pascal A. Niklaus
summary(lm(x ~ I(t^2))), but you should probably read the Introduction to R Pascal __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

[R] Hierarchical glm

2003-11-06 Thread Pascal A. Niklaus
Hi all, I'm not sure how to correctly analyse the following data with glm, and hope for some advice from this list, ideally showing how to specify the model in R and perform the tests, and also for suggestions of literature. The data structure is like this: - 20 plant populations were

Re: [R] help with lme()

2003-11-05 Thread Pascal A. Niklaus
As far as I understand it, the problem is that REML accounts for the degrees of freedom used up by fixed effects (e.g., treatments), whereas ML does not account for these. From that perspective, REML appears to be the better fitting method. However, if you test for a fixed effect by comparing

[R] converting column to factor *within* a data frame

2003-11-05 Thread Pascal A. Niklaus
Hi all, I repeatedly encounter the following problem: After importing a data set into a data frame, I wish to set a column with numeric values to be a factor, but can't figure out how to do this. Also, I do not wish to write as.factor(x) all the time. I can create a new vector with x -

Re: [R] random number generation

2003-10-28 Thread Pascal A. Niklaus
You need to know the exact distribution of the random numbers you want to generate. For rnorm, in fact, you do not just specify the mean and the variance, but implicitely also that the data is normally distributed. Likewise, it is not sufficient to give min, max, skewness etc, you also need to

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

[R] plotmath question: y'

2003-10-22 Thread Pascal A. Niklaus
Hi all, I wonder how to correctly write the following expression (it's the axis label in a plot command): ylab=expression(y' == y - bar(y) ) Somehow the single quote in y' is causing the problems, I guess because it is interpreted as a quote... Does it have to be escaped? But how? Thanks

[R] Rotate a plot, and subplot

2003-10-13 Thread Pascal A. Niklaus
Hi all, Is there a way to rotate a plot, e.g. a histogram, by a certain angle (90/180/270 degress)? I spent hours trying to figure out how this is done, but without success. Also, I'm looking for an equivalent to the S-Plus subplot command to insert a kind of thumbnail graphic into a bigger

[R] Contrast specified with C() - R vs S-Plus problem

2003-10-08 Thread Pascal A. Niklaus
(y.anova) In R, it fails with the following error: levels(CO2) [1] A C E y.anova - aov(y + C(CO2,c(1,0,-1)) ) Error in contrasts-(*tmp*, value = contr) : wrong number of contrast matrix rows What is the way to do this in R? Thanks Pascal -- Dr. Pascal A. Niklaus Institute

Re: [R] Contrast specified with C() - R vs S-Plus problem

2003-10-08 Thread Pascal A. Niklaus
Thanks for the reply. Below is the solution and the S-Plus and R code that does the same (for documentation). I can't reproduce that in S-PLUS 6.1, and it is not as documented: In S-Plus 2000, C() complements the contrast matrix with orthogonal contrasts if only the first is given. CO2 -