[R] is it possible to map 2 plots(c and d) in a single output plot?

2010-08-13 Thread newbie_2010
is it possible to map 2 plots(c and d) in a single output plot? library(ggplot2) c <- ggplot(mtcars, aes(qsec, wt)) d <- ggplot (mtcars, aes(qsec, wt)) c + stat_smooth(fill="darkgrey", colour="blue", size=2, alpha = 0.2) d + stat_smooth(fill="darkgrey", colour="red", size=2, alpha = 0.2) -- View

Re: [R] detecting a key press

2010-08-13 Thread Greg Snow
The playSudoku function in the Sudoku package reacts to keypresses using windows or Tk, you can use that as an example. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-projec

Re: [R] merge function in R?

2010-08-13 Thread Charles C. Berry
On Fri, 13 Aug 2010, fishkbob wrote: So I have a bunch of c(start,end) points and want to consolidate them into as few c(start,end) as possible. For example: sample startend A 5 10 B 7 18 C 14 D 16 20 I'd want

Re: [R] Learning ANOVA

2010-08-13 Thread Stephen Liu
Hi Chris, Thanks for your advice which works for me here. I'm reading; An Introduction to R http://h1.mg4.mail.yahoo.com/dc/launch?sysreq=ignore NOT finish yet. Also I found many tutorials on Internet. I'll take me time going through all of them. I'm interesting reading tutorial with demo.

Re: [R] R execution

2010-08-13 Thread David Winsemius
On Aug 13, 2010, at 6:57 PM, chantalm wrote: So I have a for loop for (i in 1 : 5) { print(i) } and I want it to print 1, 2, 3, 4, 5 sequentially for each loop iteration. Instead, it waits for the whole loop to finish and then prints. It's strange because my R console seems to have two m

Re: [R] How to add lines to lattice plot produced by rms::bplot

2010-08-13 Thread David Winsemius
On Aug 13, 2010, at 11:25 PM, Duncan Mackay wrote: Hi David I do not know if you have done something like this. I had tried a few efforts like that, starting with an examination of str(bp.plot) as you demonstrate. I tried str(bp.plot) which gave the section about the regions (for colou

Re: [R] how to eliminate an element of a list

2010-08-13 Thread David Winsemius
On Aug 13, 2010, at 4:06 PM, fishkbob wrote: list<-seq(2,10,2) list [1] 2 4 6 8 10 list[-which(2==list)] [1] 4 6 8 10 using the which() will let you remove things from a list that have a specified value... I usually use the blah<- blah[-which(TRUE==is.na(blah)) ] which will remov

Re: [R] different outcomes of P values in SPSS and R

2010-08-13 Thread Martin Teicher
What your saying is true. The sequential/marginal difference can account for the discrepancy in p values but not necessarily the coefficients. One thing I've found that can lead to differences in coefficients and p values between R and SPSS is whether or not you specify that a variable is a fa

Re: [R] How to add lines to lattice plot produced by rms::bplot

2010-08-13 Thread Duncan Mackay
Hi David I do not know if you have done something like this. I tried str(bp.plot) which gave the section about the regions (for colours) as: $ panel.args.common:List of 8 ..$ x : num [1:2500] 27 28 29 29.9 30.9 ... ..$ y : num [1:2500] 141 141 141 141 141 ... ..$ z : num [1:

Re: [R] Learning ANOVA

2010-08-13 Thread Stephen Liu
Hi JesperHybel, Thanks for your advice. >If you're trying to follow the youtube video you have a typing mistake here: >InsectSprays.aov <-(test01$count ~ test01$spray) >I think this should be: >InsectSprays.aov <-aov(test01$count ~ test01$spray) Your advice works for me. Sorry I missed "aov

Re: [R] different outcomes of P values in SPSS and R

2010-08-13 Thread Ben Bolker
Yes, but ... the original poster said the coefficients differed too. (The blog post you refer to deals with ANOVA (i.e. linear models) rather than GLMs (generalized linear models): it is true that the sequential/marginal distinction still applies, but I don't think that can be the *only* thing

Re: [R] different outcomes of P values in SPSS and R

2010-08-13 Thread Martin Teicher
R usesType I sequential SS, not the default Type III marginal SS reported by SPSS. There is a good blog post explaining this difference along with some interesting comments -- http://myowelt.blogspot.com/2008/05/obtaining-same-anova-results-in-r-as-in.html Best Wishes, Martin H. Teicher Dept

Re: [R] what is scaling in plot

2010-08-13 Thread Ben Bolker
elaine kuo gmail.com> writes: > Pls kindly advise what scaling is in plot. > Sometime it could be negative but sometimes it might be positive > .(I guess it is the proportion between the plot and the margin) Your question is unclear. Please give more context and/or details. __

Re: [R] detecting a key press

2010-08-13 Thread Ben Bolker
Martin Teicher hms.harvard.edu> writes: > I'm relatively new to r. I'd like to have a user respond by > pressing a 1 or a 2 and determining their choice and > the time of response. Previous postings have indicated that > keyboard responses can be processed using > scan and readline but both se

[R] discerning species by color in cca biplot

2010-08-13 Thread elaine kuo
Dear List, I am running constrained correspondence analysis for abundance data of 7 birds. However, I would like to check which bird prefers which environment gradient by showing the species with different colors of the dots in cca plot (package vegan). Please kindly help and thank you Elaine

[R] what is scaling in plot

2010-08-13 Thread elaine kuo
Dear List, Pls kindly advise what scaling is in plot. Sometime it could be negative but sometimes it might be positive .(I guess it is the proportion between the plot and the margin) Thanks Elaine [[alternative HTML version deleted]] __ R-hel

Re: [R] different outcomes of P values in SPSS and R

2010-08-13 Thread Ben Bolker
Leo Vorthoren nioo.knaw.nl> writes: > I have been using generalized linear models in SPSS 18, in order to build > models and to calculate the P values. When I was building models in Excel > (using the intercept and Bs from SPSS), I noticed that the graphs differed > from my expectations. When I r

[R] detecting a key press

2010-08-13 Thread Martin Teicher
Hi Folks, I'm relatively new to r. I'd like to have a user respond by pressing a 1 or a 2 and determining their choice and the time of response. Previous postings have indicated that keyboard responses can be processed using scan and readline but both seem to wait for the user to also press r

Re: [R] Polygon Graph in lattice/ lattice extra

2010-08-13 Thread Felix Andrews
OK, I've added a 'horizontal' argument to panel.xyarea(), which is consistent with the meaning in panel.xyplot(). It is available from R-forge via SVN now, or as a built package within a day or 2 probably. Questions like this are best sent to package maintainers directly, I think. Regards # Felix

Re: [R] Learning ANOVA

2010-08-13 Thread Stephen Liu
- Original Message From: "Liaw, Andy" To: Stephen Liu ; r-help@r-project.org Sent: Sat, August 14, 2010 12:48:33 AM Subject: RE: [R] Learning ANOVA >Note the names of the variables here. They don't match what you tried >to use in your boxplot() call below. Where did you get the idea t

Re: [R] how to eliminate an element of a list

2010-08-13 Thread fishkbob
Try to do this > list <- seq(1,5,1) > list<-list[-3] > list [1] 1 2 4 5 list[-x] will remove the xth value in your list. Also you can do something like > list[-c(1:4)] [1] 5 To remove values at indexes 1-4 > list[-c(1,4)] [1] 2 3 5 To remove values at indexes 1 and 4 -- View this message in

[R] merge function in R?

2010-08-13 Thread fishkbob
So I have a bunch of c(start,end) points and want to consolidate them into as few c(start,end) as possible. For example: sample startend A 5 10 B 7 18 C 14 D 16 20 I'd want the function to return the two distinct

Re: [R] hypergeometric vs fisher.test

2010-08-13 Thread TGS
"or an incompetent" Such harsh words Peter. You're not making this a friendly environment for people to ask questions. Is there a less competent attribute mailing list so that some of us don't offend you with our questions? On Aug 13, 2010, at 2:11 PM, Peter Dalgaard wrote: Andrea Franceschini

Re: [R] how to eliminate an element of a list

2010-08-13 Thread fishkbob
> list<-seq(2,10,2) > list [1] 2 4 6 8 10 > list[-which(2==list)] [1] 4 6 8 10 using the which() will let you remove things from a list that have a specified value... I usually use the blah<- blah[-which(TRUE==is.na(blah)) ] which will remove all NA values in your list -- View this mes

[R] R execution

2010-08-13 Thread chantalm
So I have a for loop for (i in 1 : 5) { print(i) } and I want it to print 1, 2, 3, 4, 5 sequentially for each loop iteration. Instead, it waits for the whole loop to finish and then prints. It's strange because my R console seems to have two modes of execution. One where it will iterate for each

Re: [R] Odp: help

2010-08-13 Thread milly
Please,when i export the output from R to excel.I am not getting all the 15,000 observations but only 2000.Thank you -- View this message in context: http://r.789695.n4.nabble.com/help-tp2323542p2324459.html Sent from the Export many data to Excel 2007 mailing list archive at Nabble.com. __

[R] How to add lines to lattice plot produced by rms::bplot

2010-08-13 Thread David Winsemius
I have a plot produced by function bplot (package = rms) that is really a lattice plot (class="trellis"). It is similar to this plot produced by a very minor modification of the first example on the bplot help page: requiere(rms) n <- 1000# define sample size set.seed(17) # so can rep

Re: [R] Bug in t.test?

2010-08-13 Thread Peter Dalgaard
(Ted Harding) wrote: > Johannes' original query was about differences when there > are NAs, corresponding to different settings of "na.action". > It is perhaps possible that 'na.action="na.pass"' and > 'na.action="na.exclude"' result in different pairings in the > case "paired=TRUE". However, it s

Re: [R] Bug in t.test?

2010-08-13 Thread Ted Harding
Hi Thomas, I'm not too sure about your interpretation. Consider: set.seed(54321) X <- rnorm(10) ; Y <- rnorm(10) XY <- c(X,Y); group<-c(rep(0,10),rep(1,10)) t.test(X,Y,paired=TRUE) # Paired t-test # data: X and Y # t = -1.5265, df = 9, p-value = 0.1612 # 95 percent confi

Re: [R] Kalman filter

2010-08-13 Thread Spencer Graves
Other terms for Kalman filtering, prediction and smoothing are "state space modeling" and "dynamic linear models". Consider the following extension of Ben Bolker's suggestion to use the 'sos' package: library(sos) k <- ???Kalman ss <- findFn('state space') dlm <- findFn('dynami

Re: [R] merge function in R?

2010-08-13 Thread David Winsemius
Neither you nor your responder have continued the eamil chain very well so let me put things back together: on Aug 13, 2010; 03:54pm fishkbob wrote subj = merge function in R? So I have a bunch of c(start,end) points and want to consolidate them into as few c(start,end) as possible. For ex

Re: [R] decision tree finetune

2010-08-13 Thread Olga Shaganova
I figured it out myself, here it is: control=rpart.control(cp=.001)) Thank you! On Fri, Aug 13, 2010 at 12:58 PM, Olga Shaganova wrote: > My decision tree grows only with one split and based on what I see in > E-Miner it should split on more variables. How can I adjust splitting > criteria in R

Re: [R] merge function in R?

2010-08-13 Thread fishkbob
I too think I worded it incorrectly... so the second two columns of the matrix are the start and end of an interval however, because some of the intervals overlap, I want to limit the number of intervals I have to deal with. So therefore, (5 10)should merge with(7 18) making

Re: [R] merge function in R?

2010-08-13 Thread JesperHybel
I think it would be helpful if you could clarify youre question - do you want distinct sets - maybe use unique() but why (5,20) when its (5,10) in the row in youre example? What criteria do you want the function to select the "sets" by and what kind of output do you need? Maybe it's just me w

Re: [R] Bug in t.test?

2010-08-13 Thread Johannes W. Dietrich
Thank you for the fast reply! Although I have read the help page for t.test over and over again I have obviously overlooked the relevant sentence. The "workaround" that I have planned seems to be the correct use. Thanks again, J. W. D. At 15:31 Uhr -0700 13.08.2010, Thomas Lumley wrote: Than

Re: [R] Bug in t.test?

2010-08-13 Thread Thomas Lumley
Thanks for the clear example. However, if there is a bug it is only that t.test.formula doesn't throw an error when given the paired=TRUE option. The documentation says "The formula interface is only applicable for the 2-sample tests.", but there probably should be an explicit check -- I did

[R] Installing rJava fails on Gentoo (amd64) with Sun JDK - checking JNI data types... error

2010-08-13 Thread Anthony Staines
Installing rJava fails consistently, whether installed via the command line as below, or through "install.packages( 'rJava' )", and whether 0.84 or 0.85 is used, with the message :- "checking JNI data types... configure: error: One or more JNI types differ from the corresponding native type. You ma

[R] Lattice xyplots plots with multiple lines per cell

2010-08-13 Thread Robin Jeffries
Hello, I need to plot the means of some outcome for two groups (control vs intervention) over time (discrete) on the same plot, for various subsets such as gender and grade level. What I have been doing is creating all possible subsets first, using the aggregate function to create the means over

[R] Bug in t.test?

2010-08-13 Thread Johannes W. Dietrich
Hello all, due to unexplained differences between statistical results from collaborators and our lab that arose in the same large proteomics dataset we reevaluated the t.test() function. Here, we found a weird behaviour that is also reproducible in the following small test dataset: Suppose,

Re: [R] Unable to retrieve residual sum of squares from nls output

2010-08-13 Thread Gabor Grothendieck
On Fri, Aug 13, 2010 at 5:32 PM, Gabor Grothendieck wrote: > On Fri, Aug 13, 2010 at 5:21 PM, Dennis Fisher wrote: >> Colleagues, >> >> I am using "nls" successfully (2.11.1, OS X) but I am having difficulties >> retrieving part of the output - residual sum of squares.  I have assigned >> the o

Re: [R] Unable to retrieve residual sum of squares from nls output

2010-08-13 Thread Jun Shen
Hi, Dennis, Does this give what you want? >sum(resid(FIT)^2) Jun Senior Pharmacokineticist Seventh Wave Labs On Fri, Aug 13, 2010 at 4:21 PM, Dennis Fisher wrote: > Colleagues, > > I am using "nls" successfully (2.11.1, OS X) but I am having difficulties > retrieving part of the output - resi

Re: [R] Unable to retrieve residual sum of squares from nls output

2010-08-13 Thread Gabor Grothendieck
On Fri, Aug 13, 2010 at 5:21 PM, Dennis Fisher wrote: > Colleagues, > > I am using "nls" successfully (2.11.1, OS X) but I am having difficulties > retrieving part of the output - residual sum of squares.  I have assigned the > output to FIT: >> > FIT >> Nonlinear regression model >>   model:  N

[R] Unable to retrieve residual sum of squares from nls output

2010-08-13 Thread Dennis Fisher
Colleagues, I am using "nls" successfully (2.11.1, OS X) but I am having difficulties retrieving part of the output - residual sum of squares. I have assigned the output to FIT: > > FIT > Nonlinear regression model > model: NEWY ~ PMESOR + PAMPLITUDE * cos(2 * pi * (NEWX - POFFSET)/PERIOD)

Re: [R] hypergeometric vs fisher.test

2010-08-13 Thread Peter Dalgaard
Andrea Franceschini wrote: > I ask the question also because I found this line in Wikipedia: > "The test (see above) based on the hypergeometric distribution > (hypergeometric test) is identical to the corresponding one-tailed > version of Fisher's exact test". > > Is this wrong ? May I kindly as

Re: [R] Kalman filter

2010-08-13 Thread Bruno Mourato
Take a look on this Packages: - KFTRACK - UKFSST - TRACKIT 2010/8/13 FMH > Dear All, > > Could anyone give me a hand to suggest few packages in R to running Kalman > prediction and filtration ? > > Thanks > Fir > > > > > __ > R-help@r-project.org m

Re: [R] Lattice: Superimposing histograms with different colors and transparency effects

2010-08-13 Thread Jorge Ivan Velez
Hi Yvonnick, Have you looked at ggplot2? There are two examples at the end of [1]. HTH, Jorge [1] http://had.co.nz/ggplot2/geom_histogram.html On Fri, Aug 13, 2010 at 4:12 PM, Yvonnick NOEL <> wrote: > Dear users, > > I would like to plot several histograms superimposed on the same panel >

[R] Lattice: Superimposing histograms with different colors and transparency effects

2010-08-13 Thread Yvonnick NOEL
Dear users, I would like to plot several histograms superimposed on the same panel with different colors, with superimposed polygons appearing with transparency effects. I also want estimated densities to appear on the same plot. For several reasons, including that I like it, I want to use the lat

Re: [R] assign multiple variables at once

2010-08-13 Thread Brian Diggs
On 8/13/2010 11:08 AM, Hosack, Michael wrote: R Experts, I would like to create a series of variables without having to assign a separate line of code for each new variable. My dataframe (DF) contains two groups of linked variables (ESP1:ESP9) and (ECRL1:ECRL9). Within ESP1:ESP9 are abbreviate

Re: [R] Dealing with data

2010-08-13 Thread TGS
But in your comment, it sounded like you were in the realm of ANOVA when you made the degrees of freedom comment. I'm not going to get into the theory of statistics with you :) I'm just trying to learn R, take it easy. Yes, I understand that in the regression problem, the degrees of freedom for

[R] decision tree finetune

2010-08-13 Thread Olga Shaganova
My decision tree grows only with one split and based on what I see in E-Miner it should split on more variables. How can I adjust splitting criteria in R? Also is there way to indicate that some variables are binary, like variable Info_G is binary so in the results would be nice to see "2) Info_G=

Re: [R] Dealing with data

2010-08-13 Thread TGS
# I wasn't trying to do ANOVA. I was simply trying to figure out how regress count on sprays (this is after I saw another poster asking an unrelated question with the InsectSprays dataset). # # Anyhow, David clarified this but also, thanks for your explanation as well. rm(list = ls()); sprays <

Re: [R] transforming dates into years

2010-08-13 Thread Saeed Abu Nimeh
myFrame$year<-years(strptime(x)) On Fri, Aug 13, 2010 at 12:36 PM, Dimitri Liakhovitski wrote: > Hello! > > If I have in my data frame MyFrame a variable saved as a Date and want > to translate it into years, I currently do it like this using "zoo": > > library(zoo) > as.year <- function(x) as.nu

Re: [R] transforming dates into years

2010-08-13 Thread David Winsemius
On Aug 13, 2010, at 3:36 PM, Dimitri Liakhovitski wrote: Hello! If I have in my data frame MyFrame a variable saved as a Date and want to translate it into years, I currently do it like this using "zoo": library(zoo) as.year <- function(x) as.numeric(floor(as.yearmon(x))) myFrame$year<-as.yea

Re: [R] transforming dates into years

2010-08-13 Thread Henrique Dallazuanna
You've tried: as.numeric(format(Sys.Date(), '%Y')) On Fri, Aug 13, 2010 at 4:36 PM, Dimitri Liakhovitski < dimitri.liakhovit...@gmail.com> wrote: > Hello! > > If I have in my data frame MyFrame a variable saved as a Date and want > to translate it into years, I currently do it like this using "

[R] transforming dates into years

2010-08-13 Thread Dimitri Liakhovitski
Hello! If I have in my data frame MyFrame a variable saved as a Date and want to translate it into years, I currently do it like this using "zoo": library(zoo) as.year <- function(x) as.numeric(floor(as.yearmon(x))) myFrame$year<-as.year(myFrame$date) Is there a function that would do it directl

Re: [R] Dealing with data

2010-08-13 Thread Greg Snow
So you want 1 degree of freedom for InsectSprays? You believe that the difference between A and B is exactly the same as between B and C which is exactly the same as between D and E (etc.)? that seems an odd assumption, but you can get that by using as.numeric (as I and others have already sta

Re: [R] Equality of Vectors

2010-08-13 Thread Dimitris Rizopoulos
have a look at function all() but also at function all.equal() -- for your example, x1 <- c(1,2,3) x2 <- c(1,2,3) x3 <- c(1,2,5) all(x1 == x2) all(x1 == x3) # this safer isTRUE(all.equal(x1, x2)) isTRUE(all.equal(x1, x3)) I hope it helps. Best, Dimitris On 8/13/2010 8:49 PM, Downey, Patri

Re: [R] Equality of Vectors

2010-08-13 Thread Henrique Dallazuanna
all(c(1, 2, 3) %in% c(1,2,3)) On Fri, Aug 13, 2010 at 3:49 PM, Downey, Patrick wrote: > Hello, > > Is there a way to get a single TRUE or FALSE statement from comparing two > vectors? For example, > c(1,2,3) == c(1,2,3) > produces > TRUE TRUE TRUE > > where I would like it to produce only > TRUE

Re: [R] Equality of Vectors

2010-08-13 Thread Derek Ogle
Patrick, See all(). For example, > all(c(1,2,3)==c(1,2,3)) [1] TRUE > all(c(1,2,3)==c(2,1,3)) [1] FALSE > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Downey, Patrick > Sent: Friday, August 13, 2010 1:49 PM > To: r-help@r

Re: [R] Equality of Vectors

2010-08-13 Thread Jorge Ivan Velez
Hi Mitch, How about identical()? > identical(c(1,2,3), c(1,2,5)) [1] FALSE > identical(c(1,2,3), c(1,2,3)) [1] TRUE See ?identical and ?all.equal for more information. HTH, Jorge On Fri, Aug 13, 2010 at 2:49 PM, Downey, Patrick <> wrote: > Hello, > > Is there a way to get a single TRUE or FA

Re: [R] Equality of Vectors

2010-08-13 Thread Phil Spector
?all - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec.

Re: [R] Equality of Vectors

2010-08-13 Thread Nikhil Kaza
?all nikhil.l...@gmail.com On Aug 13, 2010, at 2:49 PM, Downey, Patrick wrote: c(1,2,3) == c(1,2,3) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

Re: [R] Re : Re : How to compare the effect of a variable across regression models?

2010-08-13 Thread Bert Gunter
Comments inline below. -- Bert On Fri, Aug 13, 2010 at 11:04 AM, Biau David wrote: > This is all very interesting indeed. > > so I appreciate that the effect of a variable will depend on the presence of > other variables and that the effect of this variable has a statistical > meaning only in a

[R] Equality of Vectors

2010-08-13 Thread Downey, Patrick
Hello, Is there a way to get a single TRUE or FALSE statement from comparing two vectors? For example, c(1,2,3) == c(1,2,3) produces TRUE TRUE TRUE where I would like it to produce only TRUE for use in an if statement. Likewise, when two vectors are not exactly identical (in all elements) I w

Re: [R] Re : Re : How to compare the effect of a variable across regression models?

2010-08-13 Thread Frank Harrell
Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University On Fri, 13 Aug 2010, Biau David wrote: This is all very interesting indeed. so I appreciate that the effect of a variable will depend on the presenc

Re: [R] Learning ANOVA

2010-08-13 Thread JesperHybel
If you're trying to follow the youtube video you have a typing mistake here: InsectSprays.aov <-(test01$count ~ test01$spray) I think this should be: InsectSprays.aov <-aov(test01$count ~ test01$spray) youre missing the functioncall "aov" on the right hand side of the assignment operator '<-'

[R] assign multiple variables at once

2010-08-13 Thread Hosack, Michael
R Experts, I would like to create a series of variables without having to assign a separate line of code for each new variable. My dataframe (DF) contains two groups of linked variables (ESP1:ESP9) and (ECRL1:ECRL9). Within ESP1:ESP9 are abbreviated species codes (full dataframe contains 26 co

[R] Re : Re : How to compare the effect of a variable across regression models?

2010-08-13 Thread Biau David
This is all very interesting indeed. so I appreciate that the effect of a variable will depend on the presence of other variables and that the effect of this variable has a statistical meaning only in a specific model. With the particularity of inconsistency if data arise from non normal distri

Re: [R] subsetting data points within confidence limit

2010-08-13 Thread Greg Snow
Why would you want to do this? Confidence intervals tell you about the uncertainty of the mean of y give x, not the individual data points. It may make more sense to use prediction intervals that tell you about individuals rather than means, but that still means throwing away alpha% of legitim

[R] Delete rpart/mvpart cross-validation output

2010-08-13 Thread Marie-Hélène Ouellette
Dear all, I was wondering if there is a simple way to avoid printing the multiple cross-validation automatic output to the console of recursive partitionning functions like rpart or mvpart. For example... > data(spider) > mvpart(data.matrix(spider[,1:12])~herbs+reft+moss+sand+twigs+water,spider,x

Re: [R] Learning ANOVA

2010-08-13 Thread Christopher W Ryan
Read documentation for TukeyHSD by typing the command: ?TukeyHSD The input to that function should usually be, "a fitted model object, usually an aov fit." You have not created a "fitted model object." This seems to work: model <- aov(InsectSprays$count ~ InsectSprays$spray) TukeyHSD(model) T

Re: [R] Dealing with data

2010-08-13 Thread TGS
# Greg, if R automatically does that then I don't know why it's treating each indicator # as a different regressor. In other words, I am interested in treating 'spray' as one # independent variable. # # Erik, which book do you suggest I read? Thanks. data(InsectSprays) lm(InsectSprays$count ~ 0

Re: [R] How to compare the effect of a variable across regression models?

2010-08-13 Thread Greg Snow
If you just want to visualize the effect on one variable on the response from some different models then you might try Predict.Plot from the TeachingDemos package. It takes a little tweaking to get it to work with cph objects, but here is a basic example (partly stolen from the help page for cp

Re: [R] Dealing with data

2010-08-13 Thread David Winsemius
On Aug 13, 2010, at 1:22 PM, TGS wrote: To clarify, I'd like to create a column of indicators for the respective letters so that I could maybe do regression on indicators, etc. You can just enter that column name in a regression formula. No need to create a separate variable. Try: lm(c

[R] Unobserved heterogeneity

2010-08-13 Thread fusun gonul
I need to read a data set that has multiple observations per person (like scanner panel data). I want to use optim and compute the objective function person by person where each person has multiple observations (as in latent class models a la Kamakura and Russell (JMR, 1989))? I tried to use the (

Re: [R] RDCOMClient interface - problems setting a variable

2010-08-13 Thread Mark Heckmann
I just tried to do the same task (see beloew) using the rcom package. This works fine (see below). Still I would like to now how this can be done using RDCOMClient. TIA, Mark library(rcom) ppt <- comCreateObject("PowerPoint.Application") pres <- comInvoke(comGetProperty(ppt, "Presentations"), "A

Re: [R] Dealing with data

2010-08-13 Thread Erik Iverson
TGS wrote: To clarify, I'd like to create a column of indicators for the respective letters so that I could maybe do regression on indicators, etc. For instance, "A" gets "1", "B" gets "2", and so on. That's precisely how factors are handled by modeling functions in R! No need to reinvent th

Re: [R] Dealing with data

2010-08-13 Thread Greg Snow
R/S does all of that automatically for you, you do not need to manually create the indicator variables. If you do something like: > fit <- lm( Sepal.Width ~ Species, data=iris, x=TRUE) Then look at the matrix actually used: > fit$x Or the output: > summary(fit) You will see that Species was

Re: [R] Installation problem

2010-08-13 Thread Erik Iverson
Giovanni Petris wrote: I am trying to install R-2.11.1 from sources on Ubuntu 10.04. Any particular reason? There are Ubuntu packages available... I am getting the following error when I run ./configure: configure:6683: checking how to run the C preprocessor configure:6753: result: gcc -E

[R] how to convert timeSeries to class "POSIXct"

2010-08-13 Thread Susana Santos
Hello. I´m studing extreme values and i´m using the packages: evd, fExtremes and evir. I need to convet timeSeries (or data.frame) to class "POSIXct". Like "bmw" data: > is(bmw) [1] "numeric" "vector" "index_timeSeries" Please help!! Thank you [[alternative HTML version deleted]] __

[R] Installation problem

2010-08-13 Thread Giovanni Petris
I am trying to install R-2.11.1 from sources on Ubuntu 10.04. I am getting the following error when I run ./configure: configure:6683: checking how to run the C preprocessor configure:6753: result: gcc -E configure:6773: gcc -E -I/usr/local/include conftest.c configure:6773: $? = 0 configure:6787

Re: [R] Kalman filter

2010-08-13 Thread Ben Bolker
FMH yahoo.com> writes: > > Dear All, > > Could anyone give me a hand to suggest few packages in R to running Kalman > prediction and filtration ? Teach a person to fish ... install.packages("sos") library(sos) findFn("kalman") ## perhaps this could be added to the posting guide?

Re: [R] Dealing with data

2010-08-13 Thread TGS
To clarify, I'd like to create a column of indicators for the respective letters so that I could maybe do regression on indicators, etc. For instance, "A" gets "1", "B" gets "2", and so on. On Aug 13, 2010, at 10:19 AM, David Winsemius wrote: On Aug 13, 2010, at 1:03 PM, TGS wrote: > # how wo

Re: [R] Games

2010-08-13 Thread Greg Snow
How about: tmp <- expand.grid(one = 1:11, two = 1:11) tmp$week <- ( ( tmp$one + tmp$two ) %% 11 ) + 1 # reformat for simplicity tmp2 <- tmp[ order(tmp$week), ] tmp3 <- tmp2[ tmp2$one < tmp2$two , ] ### do some checks to make sure everyone plays everyone ###exactly once and each team plays

Re: [R] Dealing with data

2010-08-13 Thread David Winsemius
On Aug 13, 2010, at 1:03 PM, TGS wrote: # how would I code in R to look at the letter of the alphabet # in the second column and create a indicator column for the # corresponding letter? data(InsectSprays) InsectSprays$spray It's already what most people mean when they say "indicator column"

[R] Dealing with data

2010-08-13 Thread TGS
# how would I code in R to look at the letter of the alphabet # in the second column and create a indicator column for the # corresponding letter? data(InsectSprays) InsectSprays$spray __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/li

Re: [R] variation of the aggregate function

2010-08-13 Thread Gabor Grothendieck
On Fri, Aug 13, 2010 at 12:26 PM, Eva Nordstrom wrote: > Is there a "more efficient/elegant" way to obtain the result "z" below. > > a <- c('pink','pink','blue','blue','gold','gold') > b <- c(5,8,9,12,7,4) > agg <- aggregate(x=b,by=list(a), FUN='mean') > m <- match(a, agg[,1]) > z <- agg[m,2] > z

[R] some helpful tips on using RODBC

2010-08-13 Thread Mike Williamson
Hey everyone, I don't have a question. Instead some helpful advice with things I've learned from trying to connect 'R' to databases using RODBC. ROBDC is a very handy tool that, once you have everything fixed up nicely, is a great way to have scripts run fairly autonomously, safe in the

Re: [R] Learning ANOVA

2010-08-13 Thread Stephen Liu
Hi Erik, I followed following video as example; ANOVA in R http://www.youtube.com/watch?v=Dwd3ha0P8uw&feature=related Now I got it done; > boxplot(test01$count ~ test01$spray) Continued: > InsectSprays.aov <-(test01$count ~ test01$spray) > summary(InsectSprays.aov) Length ClassMode

Re: [R] Learning ANOVA

2010-08-13 Thread Liaw, Andy
From: Stephen Liu > > Hi folks, > > R on Ubuntu 10.04 64 bit. > > Performed following steps on R:- > > ### to access to the object > > data(InsectSprays) > > ### create a .csv file > > write.csv(InsectSprays, "InsectSpraysCopy.csv") > > > On another terminal > $ sudo updatedb > $ locate Inse

Re: [R] Panel regression for zero-inflated count data with over-dispersion?

2010-08-13 Thread David Atkins
Steffen-- You might want to take a look at the MCMCglmm package by Jarrod Hadfield. It can run a zero-inflated overdispersed Poisson model with random-effects. (I realize you asked about a fixed-effects model, but MCMCglmm ought to functionally give you what you want -- an appropriate mode

[R] RDCOMClient interface - problems setting a variable

2010-08-13 Thread Mark Heckmann
I try to produce and modify shapes in a PowerPoint presentation but run into a difficulty setting a variable. library(RDCOMClient)# load RDCOMClient package library(SWinTypeLibs) # package SWinTypeLibs from Om

[R] variation of the aggregate function

2010-08-13 Thread Eva Nordstrom
Is there a "more efficient/elegant" way to obtain the result "z" below. a <- c('pink','pink','blue','blue','gold','gold') b <- c(5,8,9,12,7,4) agg <- aggregate(x=b,by=list(a), FUN='mean') m <- match(a, agg[,1]) z <- agg[m,2] z [[alternative HTML version deleted]] ___

Re: [R] Re : How to compare the effect of a variable across regression models?

2010-08-13 Thread Bert Gunter
Just to amplify a bit on what Frank said... Except in special circumstances (othogonal designs, say), regression models are only "guaranteed" to produce useful predictions -- they may not tell you anything meaningful about the relative effects of the regressors because, as Frank said, that depends

Re: [R] find value between two other numbers?

2010-08-13 Thread fishkbob
Awesome, that works great, and it cuts my runtime down by a lot. thanks baptiste I totally forgot that I could just check to see if the number was inbetween via less than and greater than rather than having to construct the vector. findInterval also helps with another problem I was having somew

Re: [R] Learning ANOVA

2010-08-13 Thread Erik Iverson
Performed following steps on R:- ### to access to the object data(InsectSprays) ### create a .csv file write.csv(InsectSprays, "InsectSpraysCopy.csv") On another terminal $ sudo updatedb $ locate InsectSpraysCopy.csv /home/userA/InsectSpraysCopy.csv ### Read in some data test01 <- re

[R] Learning ANOVA

2010-08-13 Thread Stephen Liu
Hi folks, R on Ubuntu 10.04 64 bit. Performed following steps on R:- ### to access to the object > data(InsectSprays) ### create a .csv file > write.csv(InsectSprays, "InsectSpraysCopy.csv") On another terminal $ sudo updatedb $ locate InsectSpraysCopy.csv /home/userA/InsectSpraysCopy.csv #

Re: [R] hypergeometric vs fisher.test

2010-08-13 Thread Andrea Franceschini
I ask the question also because I found this line in Wikipedia: "The test (see above) based on the hypergeometric distribution (hypergeometric test) is identical to the corresponding one-tailed version of Fisher's exact test". Is this wrong ? May I kindly ask a friendly explanation for not-exper

Re: [R] Games

2010-08-13 Thread Hans W Borchers
Silvano uel.br> writes: > > Hi, > > I want to build the table of a football league with 11 > teams. All play together. So will 55 games. > Since there are an odd number of teams in each round a team > will not play. The easy solution is moving around a table with one team pausing. #

Re: [R] Games

2010-08-13 Thread peter dalgaard
On Aug 13, 2010, at 5:15 PM, peter dalgaard wrote: > > On Aug 13, 2010, at 4:45 PM, Michael Bedward wrote: > >> teams <- LETTERS[1:11] >> matches <- combn(teams, 2) >> draw <- data.frame(team1=matches[1,], team2=matches[2,]) >> >> # someone will know how to do this in one line... >> time <- nu

  1   2   >