Re: [R] using color coded colorbars for bar plots

2007-12-02 Thread Jim Lemon
[EMAIL PROTECTED] wrote: Hi Jim, Thanks for getting back to me so quickly. I did look at color.legend, but that seems to plot colored blocks for the observations (in this case the mean) and not for the color.scale (which represents variance in this case). Unless there is a functionality

[R] array() misfeature

2007-12-02 Thread Allen McIntosh
Version: 2.5.1 array() is inconsistent when given non-integral dimensions: zz - array(0,dim=c(4,3.01)) dim(zz) [1] 4 3 zz - array(0,dim=c(201,4.05)) Error in dim(data) - dim : dim- : dims [product 804] do not match the length of object [814] [IMHO the code that did this is broken. My copy

Re: [R] R function for percentrank

2007-12-02 Thread John Kane
Ah so ! Thank you . --- Gabor Grothendieck [EMAIL PROTECTED] wrote: Its a bit tricky if you want to get it to work exactly the same as Excel even in the presence of runs but in terms of the R approx function I think percentrank corresponds to ties = min if the value is among those in the

[R] How to recode a factor level (within the list)?

2007-12-02 Thread Lauri Nikkinen
#Dear R-users, #I have a data.frame like this: y1 - rnorm(10) + 6.8 y2 - rnorm(10) + (1:10*1.7 + 1) y3 - rnorm(10) + (1:10*6.7 + 3.7) y - c(y1,y2,y3) x - rep(1:3,10) f - gl(2,15, labels=paste(lev, 1:2, sep=)) g - seq(as.Date(2000/1/1), by=day, length=30) DF - data.frame(x=x,y=y, f=f, g=g)

Re: [R] array() misfeature

2007-12-02 Thread Duncan Murdoch
On 02/12/2007 11:49 AM, Allen McIntosh wrote: Version: 2.5.1 That's an obsolete version, but the issue is still present in R-devel. array() is inconsistent when given non-integral dimensions: zz - array(0,dim=c(4,3.01)) dim(zz) [1] 4 3 zz - array(0,dim=c(201,4.05)) Error in dim(data) -

[R] speeding up likelihood computation

2007-12-02 Thread DEEPANKAR BASU
R Users: I am trying to estimate a model of fertility behaviour using birth history data with maximum likelihood. My code works but is extremely slow (because of several for loops and my programming inefficiencies); when I use the genetic algorithm to optimize the likelihood function, it takes

[R] Please help!

2007-12-02 Thread jimbib webber
Each number in the below list resides in a quantile. When put in order, there are 10 numbers, so the first is in the 0.1 quantile, the second in the 0.2 etc. Lets say we have 10 examples of systolic blood pressure from 30 year olds: 104,95,106,105,110,150,101,98,85,104 This is a random

Re: [R] array() misfeature

2007-12-02 Thread Ben Bolker
Duncan Murdoch-2 wrote: On 02/12/2007 11:49 AM, Allen McIntosh wrote: Version: 2.5.1 That's an obsolete version, but the issue is still present in R-devel. array() is inconsistent when given non-integral dimensions: zz - array(0,dim=c(4,3.01)) dim(zz) [1] 4 3 zz -

Re: [R] How to recode a factor level (within the list)?

2007-12-02 Thread Prof Brian Ripley
On Sun, 2 Dec 2007, Lauri Nikkinen wrote: #Dear R-users, #I have a data.frame like this: y1 - rnorm(10) + 6.8 y2 - rnorm(10) + (1:10*1.7 + 1) y3 - rnorm(10) + (1:10*6.7 + 3.7) y - c(y1,y2,y3) x - rep(1:3,10) f - gl(2,15, labels=paste(lev, 1:2, sep=)) g - seq(as.Date(2000/1/1), by=day,

Re: [R] Controlling Postscript output, size and orientation

2007-12-02 Thread Patrick Connolly
On Thu, 29-Nov-2007 at 01:22PM -0800, Nathan Vandergrift wrote: | | I'm trying to get my graphics so that I can use them in LaTeX to create (via | ) a pdf presentation. | | I've tried controlling inner and outer margins and figure size using par(), | to no avail. The ps output keeps appearing

Re: [R] How to recode a factor level (within the list)?

2007-12-02 Thread Lauri Nikkinen
Thank you Prof Ripley for your solutions, I'll get by with these. Lauri 2007/12/2, Prof Brian Ripley [EMAIL PROTECTED]: On Sun, 2 Dec 2007, Lauri Nikkinen wrote: #Dear R-users, #I have a data.frame like this: y1 - rnorm(10) + 6.8 y2 - rnorm(10) + (1:10*1.7 + 1) y3 - rnorm(10) +

[R] fitting power model in nls()

2007-12-02 Thread Milton Cezar Ribeiro
Dear all, I am still fighting against my power model. I tryed several times to use nls() but I can´t run it. I am sending my variables and also the model which I would like to fit. As you can see, this power model is not the best model to be fit, but I really need also to fit it. The model

[R] error message in lmer for logistic regression model with random intercept and slope

2007-12-02 Thread Margaret Gorlin
Greetings, I am trying to run a logistic regression model for binary data with a random intercept and slope in R 2.6.1. When I use the code: lmer1-lmer(infect ~ time+gender + (1+time|id), family=binomial, data=ichs, method=Laplace) Then from: summary(lmer1) I get the message: Error in if

[R] odfWeave error

2007-12-02 Thread Cleber N. Borges
hello all, I trying to use the package 'odfWeave' and I get the follow error: ### error message # ... Removing content.xml Post-processing the contents Error in .Call(RS_XML_Parse, file, handlers, as.logical(addContext), :

[R] error messgage in lmer for random intercept and slope model

2007-12-02 Thread Margaret Gorlin
Greetings, I am trying to run a logistic regression model for binary data with a random intercept and slope in R 2.6.1. When I use the code: lmer1-lmer(infect ~ time+gender + (1+time|id), family=binomial, data=ichs, method=Laplace) Then from: summary(lmer1) I get the message: Error in if

[R] persp() misfeature

2007-12-02 Thread Allen McIntosh
Version: Observed in 2.5.1 x - 1:10 y - 1 z - array(1:10,dim=c(10,1)) persp(x,y,z) Error in persp(x, y, z, xlim, ylim, zlim, theta, phi, r, d, scale, expand, : invalid 'x' argument The problem isn't 'x'. It's 'y'. __

Re: [R] persp() misfeature

2007-12-02 Thread Duncan Murdoch
On 02/12/2007 2:16 PM, Allen McIntosh wrote: Version: Observed in 2.5.1 x - 1:10 y - 1 z - array(1:10,dim=c(10,1)) persp(x,y,z) Error in persp(x, y, z, xlim, ylim, zlim, theta, phi, r, d, scale, expand, : invalid 'x' argument The problem isn't 'x'. It's 'y'. Right, also

Re: [R] array() misfeature

2007-12-02 Thread Duncan Murdoch
On 02/12/2007 1:31 PM, Ben Bolker wrote: Duncan Murdoch-2 wrote: On 02/12/2007 11:49 AM, Allen McIntosh wrote: Version: 2.5.1 That's an obsolete version, but the issue is still present in R-devel. array() is inconsistent when given non-integral dimensions: zz - array(0,dim=c(4,3.01))

Re: [R] fitting power model in nls()

2007-12-02 Thread Rolf Turner
Rule number 1: Read the help for the function you are using. You must supply starting values for the fit --- which the code you gave doesn't do. Rule number 2: Don't use nls()! Endless grief results. Instead try: foo - function(par,x,y){ Const - par[1] B - par[2] A - par[3]

Re: [R] How to recode a factor level (within the list)?

2007-12-02 Thread Lauri Nikkinen
It seems I didn't get by with your previous solutions after all... I would still need some more advice on the subject. I edited the DF so that now all variables contain missing values (NAs). y1 - rnorm(10) + 6.8 y2 - rnorm(10) + (1:10*1.7 + 1) y3 - rnorm(10) + (1:10*6.7 + 3.7) y - c(y1,y2,y3) x -

Re: [R] fitting power model in nls()

2007-12-02 Thread Joerg van den Hoff
On Sun, Dec 02, 2007 at 11:08:01AM -0800, Milton Cezar Ribeiro wrote: Dear all, I am still fighting against my power model. I tryed several times to use nls() but I can??t run it. I am sending my variables and also the model which I would like to fit. As you can see, this power model is not

Re: [R] fitting power model in nls()

2007-12-02 Thread Gabor Grothendieck
Is that really the model we want? When we have problems sometimes its just a sign that the model is not very good in the first place. plot(richness ~ area) shows most of the points crowded the left and just a few points out to the right. This does not seem like a very good pattern for model

[R] Res: fitting power model in nls()

2007-12-02 Thread Milton Cezar Ribeiro
Dear Gabor, Thank you for your reply. In fact I am ajusting several models at same time, like linear, log-linear, log-log, piecewise etc. One of the models are the power model. I really need to fit a power model because it one of the hypothesis which have been suggested on literature. In

[R] problem installing 2.6.1 on OSX Leopard (after failed MacPorts install)

2007-12-02 Thread dankelley
This message reports a problem, and its solution. I found the solution while posting. Since others may have the same problem, I am continuing with the post. PROBLEM I am having a different problem than the one that others have reported (e.g.

Re: [R] fitting power model in nls()

2007-12-02 Thread Gabor Grothendieck
OK. Since the model is linear except for A lets use brute force to repeatedly evaluate the sum of squares for values of A between -2 and 2 proceeding in steps of .01 solving the other parameters using lm. That will give us better starting values and we should be able to use nls on that. x -

Re: [R] fitting power model in nls()

2007-12-02 Thread Rolf Turner
On 3/12/2007, at 9:26 AM, Joerg van den Hoff wrote: snip and, contrary to other assessments you've received, I definitely would prefer `nls' for least squares fitting instead of using `optim' or other general minimization routines. Clearly you are far cleverer than I at getting

Re: [R] fitting power model in nls()

2007-12-02 Thread Gabor Grothendieck
Also the fitted values satisfy Const = -B = 33 (approximately) so we could try: plot(richness ~ area) nls(richness ~ C * (1 - 1/sqrt(area)), start = c(C = 33)) Nonlinear regression model model: richness ~ C * (1 - 1/sqrt(area)) data: parent.frame() C 32.85 residual sum-of-squares:

[R] documenting yoru progress

2007-12-02 Thread Tom Sgouros
Hello all: I have a function that writes a fairly elaborate report based on some survey data. For documentation and bookkeeping purposes, I'd like to write out in the report the function call that produced the report, or at least enough information to help me recreate the steps that led to that

Re: [R] documenting yoru progress

2007-12-02 Thread tom sgouros
Gabor Grothendieck [EMAIL PROTECTED] wrote: If what you mean is that you have a file, test.R, of R commands and you are using source(test.R) and you wish to discover the name test.R without hard coding it in your file, then place this in test.R: ofile - parent.frame(2)$ofile and ofile

Re: [R] documenting yoru progress

2007-12-02 Thread Gabor Grothendieck
Try this: survey.write - function(x) { +print(match.call()) +x + } out - survey.write(pi+3) survey.write(x = pi + 3) On Dec 2, 2007 6:55 PM, tom sgouros [EMAIL PROTECTED] wrote: Gabor Grothendieck [EMAIL PROTECTED] wrote: If what you mean is that you have a file, test.R, of R

[R] plotting step functions in plot vs. xyplot

2007-12-02 Thread Dylan Beaudette
Hi, I have noticed an odd inconsistency when plotting a 'step' function (type='s') in xyplot() vs. plot(). For example, given the following data: ## generate some profile depths: 0 - 150, in 10 cm increments depth - seq(0,150, by=10) ## generate some property: random numbers in this case prop -

[R] question on 64-bit compiling in leopard

2007-12-02 Thread Tae-Hoon Chung
Hi, All; I've been trying to install 64-bit R in leopard for the past several days but no luck. I thought everything worked out fine but when I tried to ran it, I got the following error: /Library/Frameworks/R.framework/Versions/2.6/Resources/bin/R: line 173:

[R] Res: fitting power model in nls()

2007-12-02 Thread Milton Cezar Ribeiro
Dear Joerg van den Hoff, I tryed your suggestion and got the following error: nls(y~B*x^A + C, start = c(A=3.2, B=0.002, C=0)) Error in nls(y ~ B * x^A + C, start = c(A = 3.2, B = 0.002, C = 0)) : singular gradient sessionInfo() R version 2.6.0 (2007-10-03) i386-pc-mingw32 locale:

Re: [R] plotting step functions in plot vs. xyplot

2007-12-02 Thread Deepayan Sarkar
On 12/2/07, Dylan Beaudette [EMAIL PROTECTED] wrote: Hi, I have noticed an odd inconsistency when plotting a 'step' function (type='s') in xyplot() vs. plot(). For example, given the following data: ## generate some profile depths: 0 - 150, in 10 cm increments depth - seq(0,150, by=10)

Re: [R] documenting yoru progress

2007-12-02 Thread tom sgouros
Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: survey.write - function(x) { +print(match.call()) +x + } out - survey.write(pi+3) survey.write(x = pi + 3) That's exactly what I need. Thank you. But now, another question. I can't seem to get the value returned by

Re: [R] documenting yoru progress

2007-12-02 Thread Gabor Grothendieck
Use format: f - function(x) { format(match.call()) } f(pi + 3) On Dec 2, 2007 8:46 PM, tom sgouros [EMAIL PROTECTED] wrote: Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: survey.write - function(x) { +print(match.call()) +x + } out - survey.write(pi+3)

[R] Function to find boundary of an irregular sample?

2007-12-02 Thread Dale Steele
Given a set of coordinates that form an irregular sampling area, is there an R function to determine boundary points (coordinates defining the limits of the area), either with or without user interaction ? # for example, given the following irregular sampling area, how could I define the boundary

Re: [R] Function to find boundary of an irregular sample?

2007-12-02 Thread Rolf Turner
library(spatstat) ?ripras Also, ``with user interaction'': ?clickpoly HTH cheers, Rolf Turner (Having said that, let me point out that it is a pretty dubious practice to ``let the data choose the window''. The observation window is *always* determined by separate

[R] trouble while installing 64-bit R in leopard

2007-12-02 Thread Tae-Hoon Chung
Hi, All; I've been trying to install 64-bit R in leopard for the past several days but no luck. I thought everything worked out fine but when I tried to ran it, I got the following error: /Library/Frameworks/R.framework/Versions/2.6/Resources/bin/R: line 173:

Re: [R] plotting step functions in plot vs. xyplot

2007-12-02 Thread Dylan Beaudette
On Sunday 02 December 2007 06:01:58 pm Deepayan Sarkar wrote: On 12/2/07, Dylan Beaudette [EMAIL PROTECTED] wrote: Hi, I have noticed an odd inconsistency when plotting a 'step' function (type='s') in xyplot() vs. plot(). For example, given the following data: ## generate some

Re: [R] How to cbind DF:s with differing number of rows?

2007-12-02 Thread Moshe Olshansky
Hi Lauri, I see two possibilities. Let say that you have a -c(1:5) b - c(1:7) c - c(1:4) l - list(a,b,c) and you want to create an Excel file with columnA (1) containing a (5 rows), column B (2) containing b and column C containing c. One possibility would be to write each ROW of the output