[R] S4 class slot name 'names' is not allowed

2006-04-13 Thread Martin Maechler
SteveL == Steven Lacey [EMAIL PROTECTED] on Wed, 12 Apr 2006 19:06:52 -0400 writes: SteveL Hi, Why doesn't this work? setClass(tests, representation(names = character)) tmp - new(tests); [EMAIL PROTECTED] - a SteveL Error in slot-(object, name, TRUE, value) : SteveL

Re: [R] S4 method dispatch matrixOrArray

2006-04-13 Thread Martin Maechler
Gabor == Gabor Grothendieck [EMAIL PROTECTED] on Wed, 12 Apr 2006 18:24:46 -0400 writes: Gabor This is surprising. I would have thought that the Gabor parent/child relationships determine the order that Gabor dispatched methods are invoked, not the order that Gabor the

[R] What does rbind(iris[,,1], iris[,,2], iris[,,3]) do?

2006-04-13 Thread Sasha Pustota
It's in the Venables Ripley MASS (ed 3) book in the section on principal components. The context is as follows ir - rbind(iris[,,1], iris[,,2], iris[,,3]) ir.species - factor(c(rep(s,50),rep(c,50),rep(v,50))) (then they use brush(ir) which I guess is not an R function) and then

Re: [R] What does rbind(iris[,,1], iris[,,2], iris[,,3]) do?

2006-04-13 Thread Prof Brian Ripley
'iris' in S-PLUS is not the same as 'iris' in R, rather similar to 'iris3' in R. You need the fourth (2002) edition of the book to work with R. The book does say in many places (including its title) it is about 'S-PLUS', but does have on-line complements about the changes needed for R of a

[R] a question on subset a dataset

2006-04-13 Thread zhijie zhang
Dear R-users, I generate a dataset d, and want to get a subset from it. ** *z-rnorm(9) coords-cbind(x=c(1,1,1,2,2,2,3,3,3),y=c(1,2,3,1,2,3,1,2,3)) d-SpatialPointsDataFrame(coords, data.frame (z=z[1:9]))* The result*/dataset* is coordinates z 1 (1, 1) 1.41173570 2 (1, 2)

Re: [R] a question on subset a dataset

2006-04-13 Thread Petr Pikal
Hi I coords was data frame you could use some arithmetic to get selection criteria for both numbers odd. In case of matrix you need to use coords[,1]*coords[,2] instead trunc((coords$x*coords$y)/2)!=((coords$x*coords$y)/2) [1] TRUE FALSE TRUE FALSE FALSE FALSE TRUE FALSE TRUE

[R] panel.abline() and trellis.focus() on multipage plots

2006-04-13 Thread vincent david
Hi, I'm recently working on a multipage bwplot() using the lattice package. In this context I was trying to use the panel.abline() function individually on certain panels but not all. After some research I found the trellis.focus() and trellis.unfocus() functions which enabled me to do something

Re: [R] a question on subset a dataset

2006-04-13 Thread P Ehlers
Or, possibly slightly simpler: ok - (x %% 2) * (y %% 2) d[ok == 1, ] Peter Ehlers Petr Pikal wrote: Hi I coords was data frame you could use some arithmetic to get selection criteria for both numbers odd. In case of matrix you need to use coords[,1]*coords[,2] instead

[R] question reg. conditional regression

2006-04-13 Thread Bernd Dittmann
Hi useRs, I have been running a regression of the following kind: summary(lm(dx[2:2747] ~ 0 + (dx[1:2746]15))) Call: lm(formula = dx[2:2747] ~ 0 + (dx[1:2746] 15)) Residuals: Min1QMedian3Q Max -46.35871 -3.15871 0.04129 3.04129 30.04129 Coefficients:

Re: [R] S4 method dispatch matrixOrArray

2006-04-13 Thread Gabor Grothendieck
Just run these two (the first example is above the == and the second after it. In the first case it gives the expected answer and in the second case one gets infinite recursion. The only difference between the two is the order of the setMethod's: setGeneric(foo, function(A, ...) {

Re: [R] S4 class slot name 'names' is not allowed

2006-04-13 Thread Steven Lacey
Martin, Thanks! I'll use name for now. Steve -Original Message- From: Martin Maechler [mailto:[EMAIL PROTECTED] Sent: Thursday, April 13, 2006 3:11 AM To: Steven Lacey Cc: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Subject: S4 class slot name 'names' is not allowed SteveL == Steven

Re: [R] What does rbind(iris[,,1], iris[,,2], iris[,,3]) do?

2006-04-13 Thread Gabor Grothendieck
What you are referring to iris is called iris3 in R so just replace iris with iris3. iris3 is a 3d array in R whereas iris is a data frame. On 4/13/06, Sasha Pustota [EMAIL PROTECTED] wrote: It's in the Venables Ripley MASS (ed 3) book in the section on principal components. The context is

Re: [R] What does rbind(iris[,,1], iris[,,2], iris[,,3]) do?

2006-04-13 Thread François Pinard
[Gabor Grothendieck] What you are referring to iris is called iris3 in R so just replace iris with iris3. iris3 is a 3d array in R whereas iris is a data frame. Thanks for this calm and simple reply. Some could learn from you! :-) -- François Pinard http://pinard.progiciels-bpi.ca

[R] How does ccf() really work?

2006-04-13 Thread Robert Lundqvist
I can't understand the results from cross-correlation function ccf() even though it should be simple. Here's my short example: * a-rnorm(5);b-rnorm(5) a;b [1] 1.4429135 0.8470067 1.2263730 -1.8159190 -0.6997260 [1] -0.4227674 0.8602645 -0.6810602 -1.4858726 -0.7008563

[R] bwplot vs boxplot$stats

2006-04-13 Thread vincent david
Hi, can I find something comparable to boxplots$stats in the resulting trellis object of a bwplot() call? All I could find was a list named panel.args, which apears to be identical to the list I get calling xyplot(). This isn't helping very much since I would still have to compute the

[R] power analysis for 2-way anova interaction

2006-04-13 Thread Justin Rhodes
Dear R-help list, Does anyone have a function that I could use to determine power for testing significance of an interaction term in a 2-way ANOVA. The model I am considering has 2 levels in each factor. I would like to be able to input sample size (equal in all groups), MSE, means for the

[R] power analysis for 2-way anova interaction

2006-04-13 Thread Justin Rhodes
Dear R-help, Does anyone have a function that I could use to determine power for testing significance of an interaction term in a 2-way ANOVA. The model I am considering has 2 levels in each factor. I would like to be able to input sample size (equal in all groups), MSE, means for the 4

[R] obtaining residuals from lmer

2006-04-13 Thread Bill Shipley
Hello. I cannot find out how to extract the residuals from a mixed model using the lmer function. Can someone help? Bill Shipley North American Editor, Annals of Botany Editor, Population and Community Biology series, Springer Publishing Département de biologie, Université de Sherbrooke,

Re: [R] [Q] Bayeisan Network with the

2006-04-13 Thread Claus Dethlefsen
Dear Young-Jin Lee Please note that there is a 'deal' mailing list, see http://www.math.aau.dk/~dethlef/novo/deal R I followed the manual and paper from the author's web site to learn it, as R shown below, but I could not figure out how to access the local and R posterior probability of the

Re: [R] obtaining residuals from lmer

2006-04-13 Thread Doran, Harold
resid(model) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bill Shipley Sent: Thursday, April 13, 2006 10:55 AM To: R help list Subject: [R] obtaining residuals from lmer Hello. I cannot find out how to extract the residuals from a mixed model using

[R] Creating an environment for a function.

2006-04-13 Thread Rolf Turner
I am trying to build a function in a context where the environment concept would appear to be useful. But I'm a bit foggy about this concept and would appreciate some pointers and advice. Basically the function I'm building, say foo(x,t), is a function of two variables). Depending on the value

[R] Fortran code

2006-04-13 Thread Sotiris Adamakis
Hi! I have faced a big problem with R on my LINUX machine. I want to load a Fortran code via R, but the program can't do it. I have tried to load simpler codes, which seem to work perfectly, but the code I would like to load - which is a little more complicated - can't be loaded. I have

[R] assigning 'heat.colors' according to ages in 'symbols()'

2006-04-13 Thread Patrick Kuss
Hi, I have spatial data for plants that I would like to plot according to its radius using sysmbols(). Also I would like to color the circles according to an individual's age using heat.colors(17) [ages within the whole data set range from 0:16]. I have not found an easy way to assign ages (=a)

Re: [R] What does rbind(iris[,,1], iris[,,2], iris[,,3]) do?

2006-04-13 Thread Sasha Pustota
Brian Ripley [EMAIL PROTECTED] wrote: 'iris' in S-PLUS is not the same as 'iris' in R, rather similar to 'iris3' in R. Thank you! This answered all my questions. You need the fourth (2002) edition of the book to work with R. The book does say in many places (including its title) it is about

Re: [R] assigning 'heat.colors' according to ages in 'symbols()'

2006-04-13 Thread Prof Brian Ripley
On Thu, 13 Apr 2006, Patrick Kuss wrote: I have spatial data for plants that I would like to plot according to its radius using sysmbols(). Also I would like to color the circles according to an individual's age using heat.colors(17) [ages within the whole data set range from 0:16]. I

Re: [R] Fortran code

2006-04-13 Thread Dave Roberts
Sotiris, R is generally fairly graceful about FORTRAN in linux; Windows is another matter. For example, R/linux will allow you to write to the R console as a file device without using the special I/O routines often needed in R. There are many very complicated FORTRAN routines currently

Re: [R] Creating an environment for a function.

2006-04-13 Thread Duncan Murdoch
On 4/13/2006 11:38 AM, Rolf Turner wrote: I am trying to build a function in a context where the environment concept would appear to be useful. But I'm a bit foggy about this concept and would appreciate some pointers and advice. Basically the function I'm building, say foo(x,t), is a

[R] Questions on formula in princomp

2006-04-13 Thread Sasha Pustota
I hope this time I'm using the iris dataset correctly: ir - rbind(iris3[,,1], iris3[,,2], iris3[,,3]) lir - data.frame(log(ir)) names(lir) - c(a,b,c,d) I'm trying to understand the meaning of expressions like ~ a+b+c+d, used with princomp, e.g. princomp(~ a+b+c+d, data=lir, cor=T) By

[R] Subset rows over multiple columns

2006-04-13 Thread Doran, Harold
I have a data frame where I need to subset certain rows before I compute the mean of another variable. However, the value that I need to subset by is found in multiple columns. For example, in the data below the value R160 is found in the first and second columns (itd_1 and itd_45). These

Re: [R] Creating an environment for a function.

2006-04-13 Thread Prof Brian Ripley
On Thu, 13 Apr 2006, Duncan Murdoch wrote: On 4/13/2006 11:38 AM, Rolf Turner wrote: I am trying to build a function in a context where the environment concept would appear to be useful. But I'm a bit foggy about this concept and would appreciate some pointers and advice. Basically the

[R] editor for Ubuntu

2006-04-13 Thread camille
Hello, I am new on Ubuntu. I would like to use R, but I tried Kate and Scite. The first one keeps trying to use KDE applications,while the other does not understand the language. I have searched for another editor for hours, in vain. Which editor should work with Ubuntu? I am looking forward

Re: [R] editor for Ubuntu

2006-04-13 Thread Dirk Eddelbuettel
On 13 April 2006 at 21:10, camille wrote: | I am new on Ubuntu. I would like to use R, but I tried Kate and Scite. | The first one keeps trying to use KDE applications,while the other does | not understand the language. I have searched for another editor for | hours, in vain. Which editor

[R] Guidance on step() with large dataset (750K) solicited...

2006-04-13 Thread Jeffrey Racine
Hi. Background - I am working with a dataset involving around 750K observations, where many of the variables (8/11) are unordered factors. The typical model used to model this relationship in the literature has been a simple linear additive model, but this is rejected out of hand by the data. I

Re: [R] Creating an environment for a function.

2006-04-13 Thread Rolf Turner
Brian Ripley wrote: Can I also suggest local()? This does a similar thing in a perhaps more natural way. Sorry, I'm not with you. I'm slow, and as I said, I don't really grok environments. Let's look at a toy example. Suppose I want to create a function foo: function(x){x^n} and

[R] assignment to a symbol created by paste

2006-04-13 Thread Chad Reyhan Bhatti
Hello, I am creating a number of objects that I wish to have a common name with an index such as x1, x2, x3, ... I would like to do everyting in a loop to make the code compact and minimize the probability of an error by typo. A test problem may look like for (j in 1:10){

Re: [R] Creating an environment for a function.

2006-04-13 Thread Thomas Lumley
On Thu, 13 Apr 2006, Rolf Turner wrote: Brian Ripley wrote: Can I also suggest local()? This does a similar thing in a perhaps more natural way. Sorry, I'm not with you. I'm slow, and as I said, I don't really grok environments. Let's look at a toy example. Suppose I want to create a

Re: [R] Creating an environment for a function.

2006-04-13 Thread Rolf Turner
Thomas Lumley wrote: foo - local({ n - 4 function(x) {x^n} }) Bewdy! Thanks a lot. Slowly but slowly ( :-) ) I learn things! cheers, Rolf

[R] printing output to a file from the command line

2006-04-13 Thread Chad Reyhan Bhatti
Hello, I have been looking for a way to print output to a file from the command line. I have looked at write(), dump(), dput(), etc and none of these seem to have the capability I am needing. Imagine that you have the output of lm(), glm(), or optim(). out - lm(); out - glm(); out - optim();

[R] Penalized Splines as BLUPs using lmer?

2006-04-13 Thread Matthias Kormaksson
Dear R-list, I´m trying to use the lmer of the lme4 package to fit a linear mixed model of the form Y = Xb + Zu + e and I can´t figure out how to control the covariance structure of u. I want u ~ N(0,sigma^2*I). More precisely I´m trying to smooth a curve through data using the Penalized

[R] Working directory

2006-04-13 Thread Gong, Yanyan
Hi, I am a new user of R, I am trying to read my data in.. Cervixhc.dat used to be in a different directory, now it has been moved to O:\Es\APC cervix FINAL (YG,MC,MD)\Manuscript\Data, but when I ran the following program (in red) I got an error message Error in setwd(dir) : cannot change working

[R] Plotting positions in qqnorm?

2006-04-13 Thread Spencer Graves
Do you know of a reference that discusses alternative choices for plotting positions for a normal probability plot? The documentation for qqnorm says it calls ppoints, which returns qnorm((1:m-a)/(m+1-2*a)) with a = ifelse(n=10, 3/8, 1/2)? The help pages for qqnorm and ppoints just

Re: [R] printing output to a file from the command line

2006-04-13 Thread Marc Schwartz (via MN)
On Thu, 2006-04-13 at 15:11 -0500, Chad Reyhan Bhatti wrote: Hello, I have been looking for a way to print output to a file from the command line. I have looked at write(), dump(), dput(), etc and none of these seem to have the capability I am needing. Imagine that you have the output of

Re: [R] Working directory

2006-04-13 Thread Marc Schwartz (via MN)
On Thu, 2006-04-13 at 16:28 -0400, Gong, Yanyan wrote: Hi, I am a new user of R, I am trying to read my data in.. Cervixhc.dat used to be in a different directory, now it has been moved to O:\Es\APC cervix FINAL (YG,MC,MD)\Manuscript\Data, but when I ran the following program (in red) I got

Re: [R] assignment to a symbol created by paste

2006-04-13 Thread Marc Schwartz (via MN)
On Thu, 2006-04-13 at 15:04 -0500, Chad Reyhan Bhatti wrote: Hello, I am creating a number of objects that I wish to have a common name with an index such as x1, x2, x3, ... I would like to do everyting in a loop to make the code compact and minimize the probability of an error by typo. A

Re: [R] panel.abline() and trellis.focus() on multipage plots

2006-04-13 Thread Deepayan Sarkar
On 4/13/06, vincent david [EMAIL PROTECTED] wrote: Hi, I'm recently working on a multipage bwplot() using the lattice package. In this context I was trying to use the panel.abline() function individually on certain panels but not all. After some research I found the trellis.focus() and

Re: [R] bwplot vs boxplot$stats

2006-04-13 Thread Deepayan Sarkar
On 4/13/06, vincent david [EMAIL PROTECTED] wrote: Hi, can I find something comparable to boxplots$stats in the resulting trellis object of a bwplot() call? All I could find was a list named panel.args, which apears to be identical to the list I get calling xyplot(). This isn't helping very

Re: [R] Plotting positions in qqnorm?

2006-04-13 Thread Berton Gunter
Spencer: I seem to remember that Jim Filliben did some work on this. Try checking the references in this: J. J. Filliben (1975) The Probability Plot Correlation Coefficient Test for Normality Technometrics, Vol. 17, No. 1, pp. 111-117 My experience agrees with yours: if sample sizes are

Re: [R] Penalized Splines as BLUPs using lmer?

2006-04-13 Thread Doran, Harold
I think you want the random effects to be independent. If so then you need lmer(response ~ time +(time|id) + (time-1|id), data) Harold -Original Message- From: [EMAIL PROTECTED] on behalf of Matthias Kormaksson Sent: Thu 4/13/2006 4:04 PM To: r-help@stat.math.ethz.ch Cc:

Re: [R] assignment to a symbol created by paste

2006-04-13 Thread Thomas Lumley
On Thu, 13 Apr 2006, Chad Reyhan Bhatti wrote: Hello, I am creating a number of objects that I wish to have a common name with an index such as x1, x2, x3, ... I would like to do everyting in a loop to make the code compact and minimize the probability of an error by typo. see FAQ 7.21

Re: [R] Creating an environment for a function.

2006-04-13 Thread Gabor Grothendieck
If you think of n and the function as components of an object then you could use the proto package to define an object, p, that contains those two components. If we assume no children of p are required (from your description I assume that that is the case) then its just: library(proto) p -

[R] loop: results for all inputs

2006-04-13 Thread gynmeerut
Dear R users, I am using a loop that does matrix multiplication in a manner (A%*%B)%*%(A) Here A is a row of data frame D of order(200x4). B is a (4x4). No need to say D[j,] is 1x4 so I am using for(j in seq(0.1,20,by=0.1)){ Slt;- (D[j,]%*%B)%*%(D[j,]) print(S) } As a

Re: [R] Penalized Splines as BLUPs using lmer?

2006-04-13 Thread Joran Elias
I've been wondering the same thing (how to specify restricted covariance structures with lmer()), and this response seemed a little opaque to me, so I was wondering if anyone could clarify. 1.) Is there currently any documentation for lmer() that explains how the model formula in lmer()

Re: [R] Questions on formula in princomp

2006-04-13 Thread Gabor Grothendieck
On 4/13/06, Sasha Pustota [EMAIL PROTECTED] wrote: I hope this time I'm using the iris dataset correctly: ir - rbind(iris3[,,1], iris3[,,2], iris3[,,3]) lir - data.frame(log(ir)) names(lir) - c(a,b,c,d) I'm trying to understand the meaning of expressions like ~ a+b+c+d, used with princomp,

[R] Vector

2006-04-13 Thread Barbora Kocúrová
Hello. I have a vector which length is n. And I would need to put off the item of the vector with index k which is less then n. Could you please advise me? Thanks Barbora K. hry.atlas.cz - Světově proslulá karetní hra Poker Texas Hold´em online

Re: [R] Vector

2006-04-13 Thread Gabor Csardi
Let n=20 and k=10. v - 1:20 v[-10] [1] 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 This is what you want? Gabor On Fri, Apr 14, 2006 at 01:24:59AM +0200, Barbora Kocúrová wrote: Hello. I have a vector which length is n. And I would need to put off the item of the vector

Re: [R] Subset rows over multiple columns

2006-04-13 Thread Gabor Grothendieck
Try this: tt2 - tt tt2[,1] - as.character(tt2[,1]) tt2[,2] - as.character(tt2[,2]) f - function(x) with(tt2, mean(righta_a[x == itd_1 | x == itd_45])) sapply(unique(unlist(tt2[,1:2])), f) On 4/13/06, Doran, Harold [EMAIL PROTECTED] wrote: I have a data frame where I need to subset certain

[R] another memory size question

2006-04-13 Thread Alexander Nervedi
Hi. I am having trouble figuring this out. Please help if you know what I am goffing up on. rm(list=ls(all=TRUE)) dat-expand.grid(village.code = c(1,2,3), household.id = 1:99, member.id = 1:41, year.code = 75:85, DOI = 1:366) Error: cannot allocate vector of size 191502 Kb memory.limit()

Re: [R] error message explanation for lmer

2006-04-13 Thread Spencer Graves
I don't know how to get that particular error message from lmer, but I can guess that it might occur when you are trying to estimate more parameters than the data will support. To overcome this, I would try the following: First, have you tried experimenting with

Re: [R] loop: results for all inputs

2006-04-13 Thread Gabor Grothendieck
See: https://www.stat.math.ethz.ch/pipermail/r-help/2006-March/089888.html and succeeding messages in thread. On 4/13/06, gynmeerut [EMAIL PROTECTED] wrote: Dear R users, I am using a loop that does matrix multiplication in a manner (A%*%B)%*%(A) Here A is a row of data frame D of

[R] Finding the format of an object redux

2006-04-13 Thread Thomas L Jones
Okay, I am dealing with an object. Without going into too much detail, a gam (Generalized Additive Model) is involved. Assume that the name of the object is obj without the quotes. I tell it: print (obj) inside a function. I get out a bunch of pairs of lines. (1) Odd-numbered lines are

Re: [R] Finding the format of an object redux

2006-04-13 Thread Gabor Grothendieck
Look at: str(obj) class(obj) dput(obj) On 4/13/06, Thomas L Jones [EMAIL PROTECTED] wrote: Okay, I am dealing with an object. Without going into too much detail, a gam (Generalized Additive Model) is involved. Assume that the name of the object is obj without the quotes. I tell it: print

[R] another very simple loop question

2006-04-13 Thread Brian Quinif
I have a dataset with 4 years of students, and normally I want to estimate things using each individual year, so I have a for loop as follows for (i in 1:4){} However, the only way I know how to calculate estimates using all four years of data is to put the estimations outside of the loop. Is

[R] vector-factor operation

2006-04-13 Thread Murray Jorgensen
I found myself wanting to average a vector [vec] within each level of a factor [Fac], returning a vector of the same length as vec. After a while I realised that lm1 - lm(vec ~ Fac) fitted(lm1) did what I want. But there must be another way to do this, and it would be good to be able to