Re: [R] randomize a matrix

2006-10-20 Thread Alex Brown
hi Cameron It so happens that the particular example P you chose has no partners under the symmetry you describe. Can you explain what this is to be used for? Could you also give an example of what the operation you desire might look like if it was successful, and

[R] Deviance Information Criterion (DIC)

2006-10-20 Thread Alexander Geisler
Hello! I'm looking forward for a package which has included the deviance information criterion. Is there any implemenation in R? I could only find an implementation of the bayesian information criterion (BIC). Regrads Alex -- Alexander Geisler * Moserhofgasse 36/1 * A-8010 Graz StV

Re: [R] Mixed effect model in R

2006-10-20 Thread Lina Jansen
Thanks for the helping links. Now, I worked out that I have to use the lme4 package (with the lmer function) for my analysis. But now I do not understand the input to the lmer function. In the lme function (of the nlme package) the correct input would in my case be:

[R] Automatic adjustment of axis

2006-10-20 Thread Samir K.C.
Dear all, Has anyone solved the problem of Automatic adjustment of axis. I checked it in R Site Search where I was delighted to find the statement of the problem but now solution. Thanks in Advance Samir Samir K.C. IIASA International Institute for Applied Systems Analysis A-2361 Laxenburg,

Re: [R] CI with sd

2006-10-20 Thread Petr Pikal
Hi On 19 Oct 2006 at 13:19, Ethan Johnsons wrote: Date sent: Thu, 19 Oct 2006 13:19:40 -0400 From: Ethan Johnsons [EMAIL PROTECTED] To: Chuck Cleland [EMAIL PROTECTED] Copies to: r-help@stat.math.ethz.ch Subject:Re:

[R] Where can I get the sweave package ?

2006-10-20 Thread justin bem
Hi, I want to know where I can get the sweave package Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. - Message d'origine De : Marc Schwartz [EMAIL PROTECTED] À : Gabor Grothendieck [EMAIL PROTECTED] Cc : R-Help r-help@stat.math.ethz.ch Envoyé

Re: [R] Where can I get the sweave package ?

2006-10-20 Thread Uwe Ligges
justin bem wrote: Hi, I want to know where I can get the sweave package Sweave() is a function in the utils package which ships with R. Uwe Ligges Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. - Message d'origine De : Marc

[R] arrows and points for error bars

2006-10-20 Thread Simon Pickett
Hello everyone, I have successfully made an error bar graph using the points() command with the arrows() command to maually add on the standard errors. However, one slightly annoying feature of using this method is that the points dont line up exactly with the arrows (if you look carefully the

Re: [R] arrows and points for error bars

2006-10-20 Thread Peter Dalgaard
Simon Pickett [EMAIL PROTECTED] writes: Hello everyone, I have successfully made an error bar graph using the points() command with the arrows() command to maually add on the standard errors. However, one slightly annoying feature of using this method is that the points dont line up

[R] Translating lme code into lmer was: Mixed effect model in R

2006-10-20 Thread Doran, Harold
This question comes up periodically, probably enough to give it a proper thread and maybe point to this thread for reference (similar to the 'conservative anova' thread not too long ago). Moving from lme syntax, which is the function found in the nlme package, to lmer syntax (found in lme4) is

Re: [R] Automatic adjustment of axis

2006-10-20 Thread hadley wickham
Has anyone solved the problem of Automatic adjustment of axis. I checked it in R Site Search where I was delighted to find the statement of the problem but now solution. If you're interested in learning a new way of making plots, ggplot (http://had.co.nz/ggplot) does this automatically.

Re: [R] Size problem with two dotcharts side by side

2006-10-20 Thread jim holtman
It appears that dotchart is not restoring some of the 'par' parameters. It only saves some specific one: oldpar - par(no.readonly=TRUE) dotchart(1:10, cex = 0.7) # first call newpar - par(no.readonly=TRUE) identical(oldpar,newpar) [1] FALSE lapply(names(oldpar), function(x)if

Re: [R] arrows and points for error bars

2006-10-20 Thread Prof Brian Ripley
It would be very helpful to have a reproducible example, including the OS and graphics device used. For example, this may only happen with certain values of 'pch' -- e.g. some graphics devices (pdf is one) plot circles using completely different code from squares. And we frequently see

[R] summing elements in a list of functions

2006-10-20 Thread James Foadi
Dear all, I have looked for an answer for a couple of days, but can't come with any solution. I have a set of functions, say: t0 - function(x) {1} t1 - function(x) {x} t2 - function(x) {x^2} t3 - function(x) {x^3} I would like to find a way to add up the previous 4 functions and obtain a

[R] RODBC problem

2006-10-20 Thread Wensui Liu
In a mdb table, I have a text field with values of 1, 2, When I use rodbc to read it into R, it becomes numeric. Is it a bug or something? Thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] summing elements in a list of functions

2006-10-20 Thread Gabor Grothendieck
Try this: L - list(function(x) 1, function(x) x, sin, cos) sumL - function(x) sum(sapply(L, function(f) f(x))) sumL(pi) # pi On 10/20/06, James Foadi [EMAIL PROTECTED] wrote: Dear all, I have looked for an answer for a couple of days, but can't come with any solution. I have a set of

Re: [R] summing elements in a list of functions

2006-10-20 Thread Peter Dalgaard
James Foadi [EMAIL PROTECTED] writes: Dear all, I have looked for an answer for a couple of days, but can't come with any solution. I have a set of functions, say: t0 - function(x) {1} t1 - function(x) {x} t2 - function(x) {x^2} t3 - function(x) {x^3} I would like to find a

Re: [R] summing elements in a list of functions

2006-10-20 Thread jim holtman
will this work for you? t0 - function(x) {1} t1 - function(x) {x} t2 - function(x) {x^2} t3 - function(x) {x^3} t.l - list(t0,t1,t2,t3) t.l [[1]] function(x) {1} [[2]] function(x) {x} [[3]] function(x) {x^2} [[4]] function(x) {x^3} arg.val - 4 # evaluate for 4

[R] How to evaluate a Variable Name?

2006-10-20 Thread Dan Chan
Hi, I have a dataframe Wash2005, which has daily weather data. I am doing a regression by month as follows: # FM10 Regression by Month # Plot 12 Month of OFM10, FFM10 for(i in 1:12) { Temp - subset (Wash2005, MM == i) assign( paste('Wash2005FM10', strtrim(month.name[i],3),

Re: [R] summing elements in a list of functions

2006-10-20 Thread Giovanni Petris
Here is one way. To have a vectorized version you need to redefine 't0', though t0 - function(x) {1} t1 - function(x) {x} t2 - function(x) {x^2} t3 - function(x) {x^3} ttt - list(t0,t1,t2,t3) rrr - function(x) sum(sapply(seq(along=ttt), function(i) ttt[[i]](x))) ## vectorized version ttt[[1]]

[R] Forest plot

2006-10-20 Thread Lucke, Joseph F
Has anyone developed a function to generate a forest plot, the one used a lot in meta-analysis? Joseph F. Lucke, PhD Biostatistician Center for Clinical Research and Evidence-based Medicine Department of Pediatrics School of Medicine University of Texas Health Science Center at Houston Voice:

Re: [R] Question about random sampling in R

2006-10-20 Thread tom soyer
Oh yes, you are right. It seems that the default distribution used for sampling is uniform. And whether the resampling generates a random distribution or not depends on the distribution being sampled. Thanks everyone for your help! I appreciate your support very much. Tom On 10/19/06, Ted

Re: [R] RODBC problem

2006-10-20 Thread Jerome Asselin
On Fri, 2006-10-20 at 10:25 -0400, Wensui Liu wrote: In a mdb table, I have a text field with values of 1, 2, When I use rodbc to read it into R, it becomes numeric. Is it a bug or something? I don't think it's a bug. This behavior is documented. See ?sqlQuery. Try the as.is=T argument.

Re: [R] Forest plot

2006-10-20 Thread Chuck Cleland
Lucke, Joseph F wrote: Has anyone developed a function to generate a forest plot, the one used a lot in meta-analysis? RSiteSearch(forest plot meta-analysis) points you to metaplot in the rmeta package. Joseph F. Lucke, PhD Biostatistician Center for Clinical Research and Evidence-based

Re: [R] randomize a matrix

2006-10-20 Thread Giovanni Petris
Cameron, In your example, I think P is the only matrix with 0-1 entries that has the given row and column sums. In general, I would solve the problem simulating a Markov Chain. Start from a given incidence matrix A and iterate the following steps: (1) select two rows, a, b, and two columns,

Re: [R] summing elements in a list of functions

2006-10-20 Thread James Foadi
Many thanks to those who have answered my question. Could I ask Gabor and Peter the meaning of: sum(sapply(ttt,function(f) f(x))) I gather that a mysterious function f(x) is applied to all components of ttt, and sum can act on this modified object. But what is exactly f? And how does the list

Re: [R] How to evaluate a Variable Name?

2006-10-20 Thread Gabor Grothendieck
Create a function f which, given Species s, calculates the residual sum of squares and then sapply it to all Species. In your case Species is the month and the levels of the Species correspond to the months 1:12 # calculate rss for Species s f - function(s) { iris.lm - lm(Sepal.Width ~

Re: [R] summing elements in a list of functions

2006-10-20 Thread Gabor Grothendieck
ttt is a list of functions so each function in ttt is passed in turn to the anonymous function as argument f. On 10/20/06, James Foadi [EMAIL PROTECTED] wrote: Many thanks to those who have answered my question. Could I ask Gabor and Peter the meaning of: sum(sapply(ttt,function(f) f(x)))

[R] lda

2006-10-20 Thread Weiwei Shi
hi, i am wondering if i could use lda$scaling (i.e. coeff) to evaluate variables' importance if all the x's are normalized before put into model? thanks. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III

Re: [R] Forest plot

2006-10-20 Thread Thomas Lumley
On Fri, 20 Oct 2006, Chuck Cleland wrote: Lucke, Joseph F wrote: Has anyone developed a function to generate a forest plot, the one used a lot in meta-analysis? RSiteSearch(forest plot meta-analysis) points you to metaplot in the rmeta package. There is also a more up-to-date and

Re: [R] arrows and points for error bars

2006-10-20 Thread Simon Pickett
Hi there, I did what Peter Dalgaard very kindly suggested and saved it as a pdf and viewed it using adobe, which as if by magic resolves the problem. It must have been a pixel issue with the r graphics device. Sorry to have wasted your time, thanks for your help, always appreciated. Simon. It

[R] I really don't understand functions in R :-)

2006-10-20 Thread Alberto Monteiro
An example: n - 3 f - function(x) x^n f(2) # [1] 8 n - 2 f(2) # [1] 4 f # function(x) x^n Ok, I know this is trivial, because function f is foverer bound to the variable n. But how can I _fix_ n when I define _f_, so that changing _n_ won't change the function f? Alberto Monteiro

Re: [R] I really don't understand functions in R :-)

2006-10-20 Thread jim holtman
It sounds like you want to use 'local' to create private variables: # your example n - 3 f - function(x) x^n f(2) [1] 8 n-1 f(2) [1] 2 # now using 'local' to make 'n' private f - local({ + n - 3 + function(x) x^n + }) f(2) [1] 8 n - 1 f(2) [1] 8 Or why not just pass 'n' to the

Re: [R] I really don't understand functions in R :-)

2006-10-20 Thread Thomas Lumley
On Fri, 20 Oct 2006, Alberto Monteiro wrote: An example: n - 3 f - function(x) x^n f(2) # [1] 8 n - 2 f(2) # [1] 4 f # function(x) x^n Ok, I know this is trivial, because function f is foverer bound to the variable n. But how can I _fix_ n when I define _f_, so that changing _n_

Re: [R] I really don't understand functions in R :-)

2006-10-20 Thread Kevin E. Thorpe
Is this what you want? f - function(x,n=3) x^n f(2) [1] 8 n - 2 f(2) [1] 8 f(2,2) [1] 4 Alberto Monteiro wrote: An example: n - 3 f - function(x) x^n f(2) # [1] 8 n - 2 f(2) # [1] 4 f # function(x) x^n Ok, I know this is trivial, because function f is foverer bound to the

Re: [R] I really don't understand functions in R :-)

2006-10-20 Thread Alberto Monteiro
Jim Holtman wrote: It sounds like you want to use 'local' to create private variables: Ok, so, in a real world example, I should do something like this: n - 3 # but here there is some very complex computations # that give me a value for n f - local({ f.n - n function(x) x^f.n }) f(2) # 8 n

Re: [R] I really don't understand functions in R :-)

2006-10-20 Thread Giovanni Petris
May I am missing something, but it seems to me that the easiest way to solve your problem, if you don't want to change 'n', is to define f - function(x) x^3 If you want to allow the possibility for 'n' to change, you can include it as an argument of 'f' f - function(x,n=3) x^n Best, Giovanni

[R] mcmcsamp - How does it work?

2006-10-20 Thread Cleber N. Borges
Hello, I am a chemical student and I make use of 'lme/lmer function' to handle experiments in split-plot structures. I know about the mcmcsamp and I think that it's very promissory. I would like knowing the concept behind of the mcmcsamp function. I do not want the C code of the MCMCSAMP

[R] CORRESPONDENCE ANALYSIS

2006-10-20 Thread Enio Jelihovschi
Enio Jelihovschi [EMAIL PROTECTED] Date: Fri, 20 Oct 2006 11:28:12 -0200 Subject: CORRESPONCE ANALYSIS Dear All I am new R user, trying to do correspondence analysis using the function mca of the package MASS. My question is: In the following example farms.mca - mca(farms, abbrev = T) # Use

[R] plotting 95% confidence bands on a simple linear regression model from lm()

2006-10-20 Thread Jason Horn
What's the best / simplest way to create 95% confidence bands for a model created with lm() that can be plotted around teh regression line? I've looked everywhere for this - I guess I must be missing something. - Jason __

Re: [R] Translating lme code into lmer was: Mixed effect model in R

2006-10-20 Thread Douglas Bates
On 10/20/06, Doran, Harold [EMAIL PROTECTED] wrote: This question comes up periodically, probably enough to give it a proper thread and maybe point to this thread for reference (similar to the 'conservative anova' thread not too long ago). Moving from lme syntax, which is the function found

Re: [R] I really don't understand functions in R :-)

2006-10-20 Thread Marcin Jaworski
jim holtman ([EMAIL PROTECTED]) wrote: It sounds like you want to use 'local' to create private variables: Hello, I hope I do not disturb your discussion very much writing in this thread but the topic sounded extremely familiar for me :) My only question is: Is there a good book or more

Re: [R] plotting 95% confidence bands on a simple linear regression model from lm()

2006-10-20 Thread Michael Kubovy
On Oct 20, 2006, at 2:46 PM, Jason Horn wrote: What's the best / simplest way to create 95% confidence bands for a model created with lm() that can be plotted around teh regression line? I've looked everywhere for this - I guess I must be missing something. - Jason library(effects)

Re: [R] plotting 95% confidence bands on a simple linear regression model from lm()

2006-10-20 Thread Marc Schwartz
On Fri, 2006-10-20 at 14:46 -0400, Jason Horn wrote: What's the best / simplest way to create 95% confidence bands for a model created with lm() that can be plotted around teh regression line? I've looked everywhere for this - I guess I must be missing something. - Jason See the

Re: [R] CI with sd

2006-10-20 Thread Ethan Johnsons
Thank you so much. I see your point. ej On 10/20/06, Petr Pikal [EMAIL PROTECTED] wrote: Hi On 19 Oct 2006 at 13:19, Ethan Johnsons wrote: Date sent: Thu, 19 Oct 2006 13:19:40 -0400 From: Ethan Johnsons [EMAIL PROTECTED] To: Chuck Cleland

[R] Dataset on Baltimore home energy costs

2006-10-20 Thread Zembower, Kevin
I received a private request for my complete dataset from my previous questions. In gratitude to the developers of R, and especially to the helpful members of r-help, I'm happy to attach it. Anyone is free to use this dataset in any manner they wish, including published books. Attribution is not

[R] Recursive decreasing sequences

2006-10-20 Thread Julian Burgos
Hello fellow R's, I'm sure there must be an easy way to do this. But after digging in the documentation and thinking about it for a while I couldn't figure it out. I need to get a decreasing recursive vector in. I mean something like this: if starting at 2, and ending at 6, the vector

Re: [R] Recursive decreasing sequences

2006-10-20 Thread Marc Schwartz
On Fri, 2006-10-20 at 12:51 -0700, Julian Burgos wrote: Hello fellow R's, I'm sure there must be an easy way to do this. But after digging in the documentation and thinking about it for a while I couldn't figure it out. I need to get a decreasing recursive vector in. I mean something

Re: [R] Recursive decreasing sequences

2006-10-20 Thread Marc Schwartz
On Fri, 2006-10-20 at 15:11 -0500, Marc Schwartz wrote: On Fri, 2006-10-20 at 12:51 -0700, Julian Burgos wrote: Hello fellow R's, I'm sure there must be an easy way to do this. But after digging in the documentation and thinking about it for a while I couldn't figure it out. I need

[R] R-2.4.0 and MS Vista OS - installing packages

2006-10-20 Thread Charles Annis, P.E.
I have installed Microsoft Vista Release Candidate 1, and R-2.4.0, on a 4 year old DELL box with a 2.26 GHz P4 and 1 gig. It was a clean install – R is the only non-MS program running. I cannot install packages from CRAN, nor from local zipped files. (I have R-2.4.0 installed on a Windows XP

Re: [R] Recursive decreasing sequences

2006-10-20 Thread Marc Schwartz
On Fri, 2006-10-20 at 15:11 -0500, Marc Schwartz wrote: On Fri, 2006-10-20 at 12:51 -0700, Julian Burgos wrote: Hello fellow R's, I'm sure there must be an easy way to do this. But after digging in the documentation and thinking about it for a while I couldn't figure it out. I need

Re: [R] Recursive decreasing sequences

2006-10-20 Thread Dimitrios Rizopoulos
try this: start.val - 2 end.val - 6500 system.time(res - unlist(lapply(start.val:end.val, :, to = end.val))) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven,

Re: [R] mcmcsamp - How does it work?

2006-10-20 Thread Douglas Bates
On 10/20/06, Cleber N. Borges [EMAIL PROTECTED] wrote: Hello, I am a chemical student and I make use of 'lme/lmer function' to handle experiments in split-plot structures. I know about the mcmcsamp and I think that it's very promising I would like knowing the concept behind of the mcmcsamp

Re: [R] Generating start values for nls

2006-10-20 Thread Douglas Bates
On 10/19/06, Paul Brewin [EMAIL PROTECTED] wrote: Dear R-listers, I would like to know if there is a way to programmatically generate parameter start values for the model y~(a*exp(b*x)+c*exp(d*x)) in R. I've scoured the help files and archives for nls() and similar searches, and have read

Re: [R] R-2.4.0 and MS Vista OS - installing packages

2006-10-20 Thread Peter Dalgaard
Charles Annis, P.E. [EMAIL PROTECTED] writes: I have installed Microsoft Vista Release Candidate 1, and R-2.4.0, on a 4 year old DELL box with a 2.26 GHz P4 and 1 gig. It was a clean install – R is the only non-MS program running. I cannot install packages from CRAN, nor from local zipped

Re: [R] Recursive decreasing sequences

2006-10-20 Thread Achim Zeileis
On Fri, 20 Oct 2006 15:16:12 -0500 Marc Schwartz wrote: Range - c(2:6) Gack Disregard the 'c' and parens there. Left over from a first attempt at a solution using c(2, 6)... Like this one: myseq4 - function(start, end) unlist(lapply(start:end, function(x) x:end)) which is

Re: [R] R-2.4.0 and MS Vista OS - installing packages

2006-10-20 Thread Clint Bowman
This week's eweek has an article on Vista's security and system administration--I'm guessing (a Linux user guess) that you are running afoul of Vista's User Account Control feature. Clint BowmanINTERNET: [EMAIL PROTECTED] Air Dispersion Modeler INTERNET:

Re: [R] R-2.4.0 and MS Vista OS - installing packages

2006-10-20 Thread Uwe Ligges
Peter Dalgaard wrote: Charles Annis, P.E. [EMAIL PROTECTED] writes: I have installed Microsoft Vista Release Candidate 1, and R-2.4.0, on a 4 year old DELL box with a 2.26 GHz P4 and 1 gig. It was a clean install – R is the only non-MS program running. I cannot install packages from

[R] binom.test

2006-10-20 Thread Ethan Johnsons
A quick question, please. 46 e coli lab samples are tested, 6 of them returned positive. So, the best point estimate for p is 6/46 = 0.1304348. For a 95% CI for p, I thought binom.test would give me the correct result, but it seems it is not the right function to use. What is the R

Re: [R] R-2.4.0 and MS Vista OS - installing packages

2006-10-20 Thread Duncan Murdoch
On 10/20/2006 4:19 PM, Charles Annis, P.E. wrote: I have installed Microsoft Vista Release Candidate 1, and R-2.4.0, on a 4 year old DELL box with a 2.26 GHz P4 and 1 gig. It was a clean install – R is the only non-MS program running. I normally try to support people who are using R in

Re: [R] binom.test

2006-10-20 Thread Francisco J. Zagmutt
Ethan, You need to explain why you think this is not the right function to use. R is doing exactly what you are asking it to do. Now is up to you to choose the methodology you feel is correct. For a good discussion on your particular issue I recommend you the following reference: A.

[R] Questions about date/time and truncating

2006-10-20 Thread Jonathan Greenberg
I'm getting a weird behavior using R 2.5.0 for MacOS X -- I have a csv file with a properly formatted date/time field, e.g. After reading in the csv to hourly_met_data, with a date field hourly_met_data$date - as.POSIXct(hourly_met_data$date) works exactly as it is supposed to (e.g. Min/max of

Re: [R] CORRESPONDENCE ANALYSIS

2006-10-20 Thread Henric Nilsson
On 2006-10-20 19:48, Enio Jelihovschi wrote: Enio Jelihovschi [EMAIL PROTECTED] Date: Fri, 20 Oct 2006 11:28:12 -0200 Subject: CORRESPONCE ANALYSIS Dear All I am new R user, trying to do correspondence analysis using the function mca of the package MASS. My question is: In the following

Re: [R] Questions about date/time and truncating

2006-10-20 Thread Jonathan Greenberg
Thanks! Worked like a charm! hourly_met_data$date - as.POSIXct(trunc(as.POSIXct(hourly_met_data$date),day)) --j On 10/20/06 3:31 PM, jim holtman [EMAIL PROTECTED] wrote: trunc returns a type of POSIXlt. You have to apply 'as.POSIXct' to the result. On 10/20/06, Jonathan Greenberg

[R] Aggregate with multiple statistics?

2006-10-20 Thread Jonathan Greenberg
Is there a way to calculate, say, the mean, min and max using aggregate using one line of code? Or do I need to call them separately (e.g. aggregate(...,mean); aggregate(...,min)) and then merge the data back together? --j -- Jonathan A. Greenberg, PhD NRC Research Associate NASA Ames Research

[R] Using a string as a variable name

2006-10-20 Thread Jason Horn
Is it possible to use a string as a variable name? For example: foo=var1 frame$foo # frame is a data frame with with a column titled var1 This does not work, unfortunately. Am I just missing the correct syntax to make this work? - Jason __

Re: [R] Using a string as a variable name

2006-10-20 Thread Duncan Murdoch
On 10/20/2006 7:28 PM, Jason Horn wrote: Is it possible to use a string as a variable name? For example: foo=var1 frame$foo # frame is a data frame with with a column titled var1 This does not work, unfortunately. Am I just missing the correct syntax to make this work? Yes, you

Re: [R] Using a string as a variable name

2006-10-20 Thread jim holtman
frame[[foo]] On 10/20/06, Jason Horn [EMAIL PROTECTED] wrote: Is it possible to use a string as a variable name? For example: foo=var1 frame$foo # frame is a data frame with with a column titled var1 This does not work, unfortunately. Am I just missing the correct syntax to make this

Re: [R] Aggregate with multiple statistics?

2006-10-20 Thread Gabor Grothendieck
Try summaryBy in package doBy. e.g. using the built in dataset CO2: summaryBy(uptake ~ Plant, CO2, FUN = c(mean, min, max)) On 10/20/06, Jonathan Greenberg [EMAIL PROTECTED] wrote: Is there a way to calculate, say, the mean, min and max using aggregate using one line of code? Or do I need to

Re: [R] R-2.4.0 and MS Vista OS - installing packages

2006-10-20 Thread Gabor Grothendieck
I run XP, not Vista, but have always installed R in c:\Program Files\R\R... and have never had a problem with the space in Program Files so I doubt that that would be the problem. On 20 Oct 2006 22:31:09 +0200, Peter Dalgaard [EMAIL PROTECTED] wrote: Charles Annis, P.E. [EMAIL PROTECTED]

[R] Cardinality constraint

2006-10-20 Thread Neuro LeSuperHéros
Hello, How do I implement a cardinality constraint with constrOptim? I want to minimize (least square) a%*%x = 4 subject to x12 x21 x34 count(x1, x2, x3)= 2 (cardinality constraint) Is there a way to specify binary integer variables with constrOptim? Here's my code so far: a -matrix(1:3,1,3)

Re: [R] Aggregate with multiple statistics?

2006-10-20 Thread hadley wickham
Try summaryBy in package doBy. e.g. using the built in dataset CO2: summaryBy(uptake ~ Plant, CO2, FUN = c(mean, min, max)) Or with reshape with a little more work: cm - melt(CO2, id=1:4) cast(cm, Type ~ Treatment, c(min,mean,max)) but you get some extra flexibility: cast(cm,

Re: [R] R-2.4.0 and MS Vista OS - installing packages

2006-10-20 Thread Charles Annis, P.E.
Problem solved! Thanks to all and especially Clint Bowman and Uwe Ligges who pointed to the fly in the ointment, viz. Vista's User Account Control, UAC. To allow installation of R packages, you must open the Vista Control Panel and choose Windows Security Center. Then turn the UAC off. This

[R] problem of mode in marginal distributions of dirichlet distribution using rdirichlet{gtools}

2006-10-20 Thread hong qin
Hi all, I have a problem using rdirichlet{gtools}. For Dir( a1, a2, ..., a_n), its mode can be found at $( a_i -1)/ ( \sum_{i}a_i - n)$; The means are $a_i / (\sum_{i} a_i ) $; I tried to study the above properties using rdirichlet from gtools. The code are: ## library(gtools)

Re: [R] x tick labels - sparse?

2006-10-20 Thread Darren Weber
OK, so that works. It reduces the number of tick marks and labels by reduction of the x array to elements that are multiples of 100. That is nice, but it's not what I really want. I do want tick marks at all elements of x, but only a sparse number of tick labels. I want to control what the

[R] Tukey-Kramer test

2006-10-20 Thread A.R. Criswell
Hello All, I found the TukeyHSD() function. Is there a Tukey-Kramer test for unbalanced data? Andrew __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] x tick labels - sparse?

2006-10-20 Thread jim holtman
try this: x - seq(-100,1000,25) y - x * x plot(x, y, xaxt = n) # plot only the 100th values y - x %% 100 == 0 axis(1, x[y], labels=x[y]) On 10/20/06, Darren Weber [EMAIL PROTECTED] wrote: OK, so that works. It reduces the number of tick marks and labels by reduction of the x array to

Re: [R] x tick labels - sparse?

2006-10-20 Thread Gabor Grothendieck
It looks weird to me too. Try this: x - seq(-100,1000,25) y - x * x plot(x, y, xaxt = n) axis(1, x, FALSE, tcl = -0.3) axis(1, x[x %% 100 == 0] ) On 10/20/06, Darren Weber [EMAIL PROTECTED] wrote: OK, so that works. It reduces the number of tick marks and labels by reduction of the x

Re: [R] binom.test

2006-10-20 Thread Ethan Johnsons
Thank you for the info. It helps. After all, it would be: 0.1304348-1.96*(sqrt((0.1304348*(1-0.1304348))/46)) [1] 0.03310968 0.1304348+1.96*(sqrt((0.1304348*(1-0.1304348))/46)) [1] 0.2277599 Does R have a function for the calculation above? ej On 10/20/06, Francisco J. Zagmutt [EMAIL

[R] help with coef

2006-10-20 Thread tom soyer
Hi, I am trying to get R to return just the slope of a linear regression line, but it seems that R has to return both the slope and the name of the slope. For example, a=coef(lm(y~miles)) a (Intercept) miles 360.3778 -7.2875 names(a) [1] (Intercept) miles a[1] (Intercept)

Re: [R] help with coef

2006-10-20 Thread Gabor Grothendieck
Using the builtin BOD data frame: as.vector(coef(lm(demand ~ Time, BOD)))[2] On 10/21/06, tom soyer [EMAIL PROTECTED] wrote: Hi, I am trying to get R to return just the slope of a linear regression line, but it seems that R has to return both the slope and the name of the slope. For

Re: [R] help with coef

2006-10-20 Thread tom soyer
Gabor, Thanks for the code example, but it seems that BOD is not needed. I still don't understand what is going on with the data structure returned by coef(). The strangness is illustrated by the following example: a=coef(lm(y~miles)) is.vector(a) [1] TRUE a[2] miles -7.2875 a=as.vector(a)

Re: [R] help with coef

2006-10-20 Thread Gabor Grothendieck
On 10/21/06, tom soyer [EMAIL PROTECTED] wrote: Gabor, Thanks for the code example, but it seems that BOD is not needed. I still demand and Time are columns of BOD so if you omit it then it won't know where they are. don't understand what is going on with the data structure returned by

Re: [R] help with coef

2006-10-20 Thread Christos Hatzis
Tom, coef returns a named vector, which is a vector with an extra attribute called names. To remove the extra attribute you can: names(a) - NULL# through the accessor function [EMAIL PROTECTED] - NULL # directly accessing the attribute names or by creating a new vector as you did

Re: [R] help with coef

2006-10-20 Thread Gabor Grothendieck
Also try this to look inside the objects: cc - coef(lm(demand ~ Time, BOD)) dput(cc) structure(c(8.52142857142858, 1.72142857142857), .Names = c((Intercept), Time)) cc2 - as.vector(cc) dput(cc2) c(8.52142857142858, 1.72142857142857) from which we see that the only difference in their

Re: [R] help with coef

2006-10-20 Thread tom soyer
Thanks Christos and Gabor. I didn't know there is such a thing called named vector in R. Very cool. Tom On 10/21/06, Christos Hatzis [EMAIL PROTECTED] wrote: Tom, coef returns a named vector, which is a vector with an extra attribute called names. To remove the extra attribute you can: