Re: [R] data transformation

2005-06-04 Thread Gabor Grothendieck
On 6/4/05, ronggui <[EMAIL PROTECTED]> wrote: > i have data fame da: > > da >x y > 1 1 a > 2 2 a > 3 3 a > 4 4 a > 5 5 a > 6 6 b > 7 7 b > 8 8 b > 9 9 b > 10 10 b > > str(da) > `data.frame': 10 obs. of 2 variables: > $ x: num 1 2 3 4 5 6 7 8 9 10 > $ y: Factor w/ 2 level

RE: [R] data transformation

2005-06-04 Thread Liaw, Andy
Try: > da$z <- da$x - ave(da$x, da$y) > da x y z 1 1 a -2 2 2 a -1 3 3 a 0 4 4 a 1 5 5 a 2 6 6 b -2 7 7 b -1 8 8 b 0 9 9 b 1 10 10 b 2 Andy > From: ronggui > > i have data fame da: > > da > x y > 1 1 a > 2 2 a > 3 3 a > 4 4 a > 5 5 a > 6 6 b > 7 7

[R] data transformation

2005-06-04 Thread ronggui
i have data fame da: > da x y 1 1 a 2 2 a 3 3 a 4 4 a 5 5 a 6 6 b 7 7 b 8 8 b 9 9 b 10 10 b > str(da) `data.frame': 10 obs. of 2 variables: $ x: num 1 2 3 4 5 6 7 8 9 10 $ y: Factor w/ 2 levels "a","b": 1 1 1 1 1 2 2 2 2 2 and i want to generate new variable da$z,when y

Re: [R] glm with a distribution free family

2005-06-04 Thread Spencer Graves
Have you considered computing and plotting sample averages and variances for different subgroups of the data then plotting variances vs. averages? This was suggested by Fahrmeir and Tutz (2001) Multivariate Statistical Modeling Based on Generalized Linear Models, 2nd ed. (Springer, Example

Re: [R] Storing data frame in a RDBMS

2005-06-04 Thread Gabor Grothendieck
On 6/4/05, Rajarshi Guha <[EMAIL PROTECTED]> wrote: > On Sat, 2005-06-04 at 13:18 -0700, Joe Conway wrote: > > Gabor Grothendieck wrote: > > > On 6/4/05, Adam Witney <[EMAIL PROTECTED]> wrote: > > >>I am using PL/R in PostgreSQL amd have written some functions to > > build my > > >>data frame. Howe

Re: [R] Storing data frame in a RDBMS

2005-06-04 Thread Rajarshi Guha
On Sat, 2005-06-04 at 13:18 -0700, Joe Conway wrote: > Gabor Grothendieck wrote: > > On 6/4/05, Adam Witney <[EMAIL PROTECTED]> wrote: > >>I am using PL/R in PostgreSQL amd have written some functions to > build my > >>data frame. However this can take some time with some large datasets > and I > >

Re: [R] Storing data frame in a RDBMS

2005-06-04 Thread Joe Conway
Gabor Grothendieck wrote: On 6/4/05, Adam Witney <[EMAIL PROTECTED]> wrote: I am using PL/R in PostgreSQL amd have written some functions to build my data frame. However this can take some time with some large datasets and I would like to not have to repeat the process and so I would like to sav

[R] glm with a distribution free family

2005-06-04 Thread Laetitia Mestdagh
Dear R users, I am trying to fit a glm with a distribution free family, link = log and variance = constant*mu. I guess I have to use the quasi family but the choices of variance are restricted to constant or mu or mu^2..., I don't know the way to choose the variance that I need, i.e. constant*

Re: [R] ts.intersect a multivariate and univariate ts

2005-06-04 Thread Gabor Grothendieck
Andy Bunn whrc.org> writes: : : Adam: : > Providing a reproducible example would be a first step... : : That's the problem, I can't. But I str has come to the rescue: We can provide it in a reproducible way like this: dput(rw) dput(pg) That will output both in a format that anyone else can p

Re: [R] barplot and missing values?

2005-06-04 Thread Marc Schwartz
On Sat, 2005-06-04 at 15:53 +0100, Dan Bolser wrote: > On Sat, 4 Jun 2005, Marc Schwartz wrote: > > >On Sat, 2005-06-04 at 14:50 +0100, Dan Bolser wrote: > > > > > > > >> This must be because of the "log='y'" option that I am using here. > >> > >> y <- c(2,4,6,8,NA,NA,NA,NA,18) > >> > >> barplot

RE: [R] ts.intersect a multivariate and univariate ts

2005-06-04 Thread Andy Bunn
Adam: > Providing a reproducible example would be a first step... That's the problem, I can't. But I str has come to the rescue: R > str(rw) Time-Series [1:307] from 1690 to 1996: 0.986 1.347 1.502 1.594 1.475 ... R > str(pg) List of 264 $ : num 0.227 $ : num 0.189 $ : num 0.237 $ : num 0.23

Re: [R] Storing data frame in a RDBMS

2005-06-04 Thread Gabor Grothendieck
On 6/4/05, Adam Witney <[EMAIL PROTECTED]> wrote: > > Hi, > > Is there anyway to store a data frame in a database, and by this I mean the > binary itself, not the contents? > > I am using PL/R in PostgreSQL amd have written some functions to build my > data frame. However this can take some time

Re: [R] How to change the value of a class slot

2005-06-04 Thread Martin Maechler
> "Ross" == Ross Boylan <[EMAIL PROTECTED]> > on Fri, 03 Jun 2005 17:04:08 -0700 writes: Ross> I defined an S4 class with a slot i. Then I wrote a regular function Ross> that attempted to increment i. Ross> This didn't work, apparently because of the general rule that a

[R] Storing data frame in a RDBMS

2005-06-04 Thread Adam Witney
Hi, Is there anyway to store a data frame in a database, and by this I mean the binary itself, not the contents? I am using PL/R in PostgreSQL amd have written some functions to build my data frame. However this can take some time with some large datasets and I would like to not have to repeat t

RE: [R] the test result is quite different,why?

2005-06-04 Thread John Fox
Dear ronggui, You're fitted different variance models: in bptest(), you're modeling the variance using any linear combination of the predictors, while in ncv.test() you're modeling the variance as a function of the fitted values, which is more restrictive. BTW, both bptest() and ncv.test() can do

Re: [R] barplot and missing values?

2005-06-04 Thread Dan Bolser
On Sat, 4 Jun 2005, Uwe Ligges wrote: >Dan Bolser wrote: > >[all previous stuff deleted] > >I see, what comes out of this longish thread is: > > - barplot() and barplot2() both have deficiencies for you particular >examples, so it is time to provide patches for both barplot() and >barplot2() (f

Re: [R] barplot and missing values?

2005-06-04 Thread Dan Bolser
On Sat, 4 Jun 2005, Marc Schwartz wrote: >On Sat, 2005-06-04 at 14:50 +0100, Dan Bolser wrote: > > > >> This must be because of the "log='y'" option that I am using here. >> >> y <- c(2,4,6,8,NA,NA,NA,NA,18) >> >> barplot2(y,log='y') >> >> Above fails. >> >> >> I appreciate that what I am try

Re: [R] can R do Fixed-effects (within) regression (panel data)?

2005-06-04 Thread Douglas Bates
On 6/4/05, ronggui <[EMAIL PROTECTED]> wrote: > i want to ask 2 questions. > > 1) can R do Random-effects GLS regression which i can get from Stata? > the following result is frome Stata.can I get the alike result from R? > > xtreg lwage educ black hisp exper expersq married union, re > > Random

Re: [R] barplot and missing values?

2005-06-04 Thread Marc Schwartz
On Sat, 2005-06-04 at 14:50 +0100, Dan Bolser wrote: > This must be because of the "log='y'" option that I am using here. > > y <- c(2,4,6,8,NA,NA,NA,NA,18) > > barplot2(y,log='y') > > Above fails. > > > I appreciate that what I am trying to do is somewhat artificial (handle > zero values o

Re: [R] barplot and missing values?

2005-06-04 Thread Uwe Ligges
Dan Bolser wrote: [all previous stuff deleted] I see, what comes out of this longish thread is: - barplot() and barplot2() both have deficiencies for you particular examples, so it is time to provide patches for both barplot() and barplot2() (for the latter, you might want to contact the pac

Re: [R] barplot and missing values?

2005-06-04 Thread Dan Bolser
On Sat, 4 Jun 2005, Uwe Ligges wrote: >Dan Bolser wrote: > >> On Sat, 4 Jun 2005, Uwe Ligges wrote: >> >> >>>Dan Bolser wrote: >>> I want to include missing values in my barplot to get the correct x-axis, for example, x <- c(1,2,3,4, 9) y <- c(2,4,6,8,18) barplot(y)

Re: [R] barplot and missing values?

2005-06-04 Thread Uwe Ligges
Dan Bolser wrote: On Sat, 4 Jun 2005, Uwe Ligges wrote: Dan Bolser wrote: I want to include missing values in my barplot to get the correct x-axis, for example, x <- c(1,2,3,4, 9) y <- c(2,4,6,8,18) barplot(y) The above looks wrong because the last height in y should be a long way over.

Re: [R] barplot and missing values?

2005-06-04 Thread Dan Bolser
On Sat, 4 Jun 2005, Uwe Ligges wrote: >Dan Bolser wrote: >> I want to include missing values in my barplot to get the correct x-axis, >> for example, >> >> x <- c(1,2,3,4, 9) >> y <- c(2,4,6,8,18) >> >> barplot(y) >> >> The above looks wrong because the last height in y should be a long way >>

[R] [R-pkgs] New CRAN package misc3d

2005-06-04 Thread Luke Tierney
The misc3d package provides a small collection of mostly rgl-based functions for 3D data: contour3d Uses rgl to render isosurfaces, or three-dimensional contours, computed by the marching cubes algorithm. image3d Crude 3d analog of image() using rgl to plot points o

Re: [R] barplot and missing values?

2005-06-04 Thread Uwe Ligges
Dan Bolser wrote: I want to include missing values in my barplot to get the correct x-axis, for example, x <- c(1,2,3,4, 9) y <- c(2,4,6,8,18) barplot(y) The above looks wrong because the last height in y should be a long way over. So I want to do something like... x <- c(1,2,3,4,5,6,7,8, 9)

[R] barplot and missing values?

2005-06-04 Thread Dan Bolser
I want to include missing values in my barplot to get the correct x-axis, for example, x <- c(1,2,3,4, 9) y <- c(2,4,6,8,18) barplot(y) The above looks wrong because the last height in y should be a long way over. So I want to do something like... x <- c(1,2,3,4,5,6,7,8, 9) y <- c(2,4,6,8,0,0

[R] can R do Fixed-effects (within) regression (panel data)?

2005-06-04 Thread ronggui
i want to ask 2 questions. 1) can R do Random-effects GLS regression which i can get from Stata? the following result is frome Stata.can I get the alike result from R? xtreg lwage educ black hisp exper expersq married union, re Random-effects GLS regression Number of obs =

Re: [R] How to 'de-cross' a table?

2005-06-04 Thread Sander Oom
Hi Thomas, Your code works perfectly! Thanks a lot, Sander. Thomas Lumley wrote: On Fri, 3 Jun 2005, Sander Oom wrote: Dear R users, I have received a table in the following format: id a b c1 c2 d1 d2 1 1 1 65 97 78 98 2 1 2 65 97 42 97 3 2 1 65 68 97 98 4

Re: [R] locator() via tcltk

2005-06-04 Thread Jean . Coursol
To illustrate (?) Professor Ripley comments, I send you an example (stolen in various places...). Note the tkwm.resizable(tt, 0, 0) directive that prevents the window rescaling (if not,the coordinates will not be correct). # # Getting the mouse coords with TclTk # # Two possibilities: tkrplot pa

Re: [R] locator() via tcltk

2005-06-04 Thread Prof Brian Ripley
You have two asynchronous processes here: your R function will return, leaving a Tk widget up. Duncan Murdoch's solution is to give you a function that will retrieve at some future stage the result of the last press (if any) of "Get coordinates" button. Is that what you want? I think it is m

[R] hausman test

2005-06-04 Thread ronggui
i am dealing with my panle data,and i have to decided if i should use fixed-effect model or random effect model.i know the hausman test can help. and anyone knows if any function can do these? thank you. __ R-help@stat.math.ethz.ch mailing list https:/