Re: [R] detecting a key press

2010-08-14 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] is it possible to map 2 plots(c and d) in a single output plot?

2010-08-14 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 this

[R] How to perform a substitution in a loop?

2010-08-14 Thread Saji Ren
Hello all: I have a data series of 500 data, and I want to limit the value of it to be less than 1. Below is my code: for (i in 1:500) +if( x[i] 1) +x[i] = 1 but the system told me it's wrong. Can anyone told me the reason? -

Re: [R] Learning ANOVA

2010-08-14 Thread JesperHybel
how to plot 4 graphs simultaneously? Depends on what graphs were talking about: A Side-by-side boxplot containing fx 4 boxplots can be generated by a single plot() command. However often you use a primary command that activivates the plot window and plots one graph, then afterwards you use

Re: [R] How ti perform a substitution in a loop?

2010-08-14 Thread Berend Hasselman
Saji Ren wrote: ... I have a data series of 500 data, and I want to limit the value of it to be less than 1. Below is my code: for (i in 1:500) +if( x[i] 1) +x[i] = 1 but the system told me it's wrong. Can anyone told me the reason? You don't show the error message. Read the

Re: [R] How to perform a substitution in a loop?

2010-08-14 Thread Peter Dalgaard
Saji Ren wrote: Hello all: I have a data series of 500 data, and I want to limit the value of it to be less than 1. Below is my code: for (i in 1:500) +if( x[i] 1) +x[i] = 1 but the system told me it's wrong. Can anyone told me the reason? Works for me, so there's something you're

Re: [R] How to perform a substitution in a loop?

2010-08-14 Thread JesperHybel
You need {} for (i in 1:500){ ...commands...} Like: x-rep(c(0.8,1.2),250) for (i in 1:500) { if (x[i]1) x[i]=1 } BR JEsper -- View this message in context: http://r.789695.n4.nabble.com/How-to-perform-a-substitution-in-a-loop-tp2325048p2325073.html Sent from the R help mailing

Re: [R] How to perform a substitution in a loop?

2010-08-14 Thread Saji Ren
that's not a problem of {}. By using {} you can put the command in one line. Still you can put the command in several lines as well by pur enter. That's why in the second line, the becomes + thank you for your reply though. saji -

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

2010-08-14 Thread Dennis Murphy
Hi: Your example doesn't make much sense as stated, but is this what you had in mind? d - ggplot (mtcars, aes(qsec, wt) d + geom_point() + stat_smooth(aes(colour = factor(cyl)), fill=darkgrey, size=2, alpha = 0.2) + scale_colour_discrete(No. cylinders) In this case, the multiple plots

Re: [R] what is scaling in plot

2010-08-14 Thread elaine kuo
code rm(list=ls()) library(vegan) library(MASS) data(varespec) print(varespec) str(varespec) #PCA vare.pca - rda(varespec) vare.pca plot(vare.pca) sum(apply(varespec, 2, var)) biplot(vare.pca, scaling = -1) Elaine On Sat, Aug 14, 2010 at 10:48 AM, Ben Bolker bbol...@gmail.com wrote:

Re: [R] Learning ANOVA

2010-08-14 Thread David Winsemius
On Aug 14, 2010, at 3:38 AM, JesperHybel wrote: JH .how to plot 4 graphs simultaneously? Depends on what graphs were talking about: A Side-by-side boxplot containing fx 4 boxplots can be generated by a single plot() command. However often you use a primary command that activivates the

Re: [R] How to perform a substitution in a loop?

2010-08-14 Thread David Winsemius
On Aug 14, 2010, at 4:05 AM, Saji Ren wrote: In response to JesperHybel, saji wrote: that's not a problem of {}. Correct, as indicated by the continuation + By using {} you can put the command in one line. Actually the curly brackets are more often used to put a series of commands

[R] cca biplot (vegan) failed in matplot

2010-08-14 Thread elaine kuo
Dear List, I am trying to plot the result of cca using matplot but failed. Pls kindly help and thanks. Elaine The error message was error in xy.coords(x, y, xlabel, ylabel, log = log) : (list) object cannot be coerced to type 'double' code rm(list=ls()) library(vegan) library(MASS)

Re: [R] creation package

2010-08-14 Thread anderson nuel
Dear r-help, I run R CMD INSTALL : c:\RpR CMD INSTALL namepackage *installing to library'c:/PROGRA~1/R/R-210~1-1/library' *installing *source* 'namepackage'... **R **preparing package for lazy loading **help Avis:./man/namepackage-package.Rd:25:'' inatttendue **installing help indices

Re: [R] cca biplot (vegan) failed in matplot

2010-08-14 Thread Gavin Simpson
Dear List, I am trying to plot the result of cca using matplot but failed. Pls kindly help and thanks. There is no 'matplot' method for cca objects. Where did you get the idea that there was one? If you want to plot the cca object, then ?plot.cca and ?ordiplot should help. Also look at the

[R] Stepwise Regression + entry/exit significance level

2010-08-14 Thread Shubha Vishwanath Karanth
Hi R, Does the step function used to perform stepwise regression has the option to specify the entry/exit significance levels for the independent variables? (This is similar to the 'slentry' and 'slstay' option in 'Proc reg' of SAS.). Or do we have any other package which does the above?

[R] Re : Difference in Monte Carlo calculation between chisq.test and fisher.test

2010-08-14 Thread Emilie Chary
Hello, Any idea? À : r-help@r-project.org Envoyé le : Jeu 12 août 2010, 12h 17min 10s Objet : [R] Difference in Monte Carlo calculation between chisq.test and fisher.test Hello all, I would like to know what the difference is between chisq.test and

Re: [R] cca biplot (vegan) failed in matplot

2010-08-14 Thread elaine kuo
Hello, Thanks for the response. matplot was tried for its function to distinguish assigned parts of a matrix by letters, for I wanna differentiate the dissimilar columns in a matrix. Any suggestion based on the idea above will be highly appreciated, such as points. Elaine On Sat, Aug 14, 2010

[R] color vector for green, red, blue

2010-08-14 Thread elaine kuo
Dear list, I am plotting dots using distinct colors according to the species. Like the style of topo.colors(18), please kindly advise if any color vector exists for green, red, and blue. Thank you Elaine [[alternative HTML version deleted]]

Re: [R] what is scaling in plot

2010-08-14 Thread Gavin Simpson
In an ordination such as this, you have two sets of scores; i) one pertaining to the (dis)similarity of your samples in terms of species composition, and ii) one pertaining to the species and which species co-occur. You can't display both sets of information and retain the meaning of the scores on

Re: [R] discerning species by color in cca biplot

2010-08-14 Thread Gavin Simpson
If you only have seven species, why not draw the label for the species (the names() component of your data) at the species score, rather than a colour? plot(OBJ, display = c(sites,species), scaling = 3, type = n) points(OBJ, display = sites, scaling = 3, type = p) points(OBJ, display = species,

Re: [R] color vector for green, red, blue

2010-08-14 Thread Henrique Dallazuanna
Take a look in RColorBrewer package. On Sat, Aug 14, 2010 at 9:13 AM, elaine kuo elaine.kuo...@gmail.com wrote: Dear list, I am plotting dots using distinct colors according to the species. Like the style of topo.colors(18), please kindly advise if any color vector exists for green, red,

Re: [R] discerning species by color in cca biplot

2010-08-14 Thread elaine kuo
Thanks I wanna to add the species labels in a cca biplot based on species and environment conditions (maybe sites are of less relevance here). 1. Gavin's suggestion worked but the dots previously displayed using plot(birdrich.cca, scaling = -1) were gone. Pls advise how to retain the dots. 2.

Re: [R] How to perform a substitution in a loop?

2010-08-14 Thread Saji Ren
Hello, Mr Dalgaard: you're right about the problem. Works for me, so there's something you're not telling us Possibly that x is not a vector (a data frame, maybe?). the mistake message is below: Error in if (track01[i] 1) track01[i] - 1 : missing value where TRUE/FALSE needed the

Re: [R] Stepwise Regression + entry/exit significance level

2010-08-14 Thread Frank Harrell
The values of slentry and slstay that will avoid ruining the statistical properties of the result are slentry=1.0 and slstay=1.0. Frank Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University On Sat, 14 Aug

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

2010-08-14 Thread Frank Harrell
Once you guys figure all this out, I'm glad to modify bplot to pass more arguments lattice if needed. Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University On Fri, 13 Aug 2010, David Winsemius wrote:

Re: [R] How to perform a substitution in a loop?

2010-08-14 Thread Peter Dalgaard
Saji Ren wrote: Hello, Mr Dalgaard: you're right about the problem. Works for me, so there's something you're not telling us Possibly that x is not a vector (a data frame, maybe?). the mistake message is below: Error in if (track01[i] 1) track01[i] - 1 : missing value where

Re: [R] Stepwise Regression + entry/exit significance level

2010-08-14 Thread Peter Dalgaard
Shubha Vishwanath Karanth wrote: Hi R, Does the step function used to perform stepwise regression has the option to specify the entry/exit significance levels for the independent variables? (This is similar to the 'slentry' and 'slstay' option in 'Proc reg' of SAS.). Or do we have any

Re: [R] Re : Difference in Monte Carlo calculation between chisq.test and fisher.test

2010-08-14 Thread Peter Dalgaard
Emilie Chary wrote: Hello, Any idea? Different test statistic (chi^2 vs. table probability). À : r-help@r-project.org Envoyé le : Jeu 12 août 2010, 12h 17min 10s Objet : [R] Difference in Monte Carlo calculation between chisq.test and fisher.test

[R] confidence Intervals for predictions in GLS

2010-08-14 Thread Camilo Mora
Hi everyone: Is there a function in R to calculate the confidence intervals for the predictions of a GLS(Generalized Least Square) model? The function predict gives confidence intervals for the predictions of other types of models (lm, glm, etc) but not gls. Any input will be much

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

2010-08-14 Thread David Winsemius
On Aug 14, 2010, at 9:59 AM, Frank Harrell wrote: Once you guys figure all this out, I'm glad to modify bplot to pass more arguments lattice if needed. As always, Frank, I appreciate your support. In this case I think it's not needed. What seems to be needed is simply the correct use of

Re: [R] confidence Intervals for predictions in GLS

2010-08-14 Thread Frank Harrell
install.packages('rms') require(rms) ?Gls ?plot.Predict Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University On Sat, 14 Aug 2010, Camilo Mora wrote: Hi everyone: Is there a function in R to calculate

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

2010-08-14 Thread Frank Harrell
Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University On Sat, 14 Aug 2010, David Winsemius wrote: On Aug 14, 2010, at 9:59 AM, Frank Harrell wrote: Once you guys figure all this out, I'm glad to

Re: [R] Bug in t.test?

2010-08-14 Thread Thomas Lumley
On Sat, 14 Aug 2010, ted.hard...@manchester.ac.uk wrote: Hi Thomas, I'm not too sure about your interpretation. Consider: It seems hard to interpret The formula interface is only applicable for the 2-sample tests. any other way Johannes' original query was about differences when there are

[R] Creating list from a long vector

2010-08-14 Thread steven mosher
Stupid question, but its been a long night. If I have a long vector how can I turn it into a list of the same length x-rep(seq(1,100,by=1),each=10) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Creating list from a long vector

2010-08-14 Thread Romain Francois
Le 14/08/10 18:22, steven mosher a écrit : Stupid question, but its been a long night. If I have a long vector how can I turn it into a list of the same length x-rep(seq(1,100,by=1),each=10) Perhaps as.list ? -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30

[R] Help with graphing impulse response functions

2010-08-14 Thread Musky Dee
Dear colleagues/contributors, I'd be pleased if someone could provide insights on how to plot impulse response functions in a format that can easily be copied in a word document just as plotting time-series of variables. I had followed the outline suggested by Benhard Pfaff [see

Re: [R] cacheSweave / pgfSweave driver for package vignette

2010-08-14 Thread baptiste auguie
Thank you everyone, I think I'll follow the technique used in Rcpp (dummy vignettes + Makefile). It would be great to have a mechanism to select the driver for vignette generation though. Also, as a side-note, the choice of a driver has its own shortcoming; I cannot use the features of highlight

Re: [R] Creating list from a long vector

2010-08-14 Thread steven mosher
Thx, I see my problem. more sleep required On Sat, Aug 14, 2010 at 9:25 AM, Romain Francois romain.franc...@dbmail.com wrote: Le 14/08/10 18:22, steven mosher a écrit : Stupid question, but its been a long night. If I have a long vector how can I turn it into a list of the same length

Re: [R] cacheSweave / pgfSweave driver for package vignette

2010-08-14 Thread Romain Francois
Le 14/08/10 19:13, baptiste auguie a écrit : Thank you everyone, I think I'll follow the technique used in Rcpp (dummy vignettes + Makefile). Cool. Let us (Rcpp team) know if you find better ways or if something is too much trickery. It would be great to have a mechanism to select the

Re: [R] Help with graphing impulse response functions

2010-08-14 Thread David Winsemius
On Aug 14, 2010, at 11:43 AM, Musky Dee wrote: Dear colleagues/contributors, I'd be pleased if someone could provide insights on how to plot impulse response functions in a format that can easily be copied in a word document just as plotting time-series of variables. I had followed the

Re: [R] Bug in t.test?

2010-08-14 Thread Ted Harding
On 14-Aug-10 16:07:14, Thomas Lumley wrote: On Sat, 14 Aug 2010, ted.hard...@manchester.ac.uk wrote: Hi Thomas, I'm not too sure about your interpretation. Consider: It seems hard to interpret The formula interface is only applicable for the 2-sample tests. any other way Johannes'

Re: [R] creation package

2010-08-14 Thread Uwe Ligges
On 14.08.2010 11:21, anderson nuel wrote: Dear r-help, I run R CMD INSTALL : c:\RpR CMD INSTALL namepackage *installing to library'c:/PROGRA~1/R/R-210~1-1/library' *installing *source* 'namepackage'... **R **preparing package for lazy loading **help Avis:./man/namepackage-package.Rd:25:''

[R] Simple problem with lm/predict

2010-08-14 Thread Nick Torenvliet
Hi all, I've got an xts time series with monthly OHLC Dow Jones industrial index data from 1980 to present, the data is in stored in x. I've done an OLS fit on the data in 1982::1994 and stored it in extrapolate1 (x[,4] contains the closing value for the index). t3 - seq(1980,1994,length =

[R] Relation 1.5*IQR/Percentile in case of a normal Distribution

2010-08-14 Thread Johannes Graumann
Hi, can someone point me at material to understand how in http://upload.wikimedia.org/wikipedia/commons/8/89/Boxplot_vs_PDF.png the fivenum-corresponding percentages might be calculated? Thanks, Joh __ R-help@r-project.org mailing list

Re: [R] Relation 1.5*IQR/Percentile in case of a normal Distribution

2010-08-14 Thread Peter Dalgaard
Johannes Graumann wrote: Hi, can someone point me at material to understand how in http://upload.wikimedia.org/wikipedia/commons/8/89/Boxplot_vs_PDF.png the fivenum-corresponding percentages might be calculated? Looks like a pretty straightforward application of pnorm() and qnorm().

[R] Unequal variance ANOVA using gls function in nlme

2010-08-14 Thread Samantha Patrick
Hi I am trying to run an ANOVA on data with unequal variance. I am new to nlme, but to my understanding I need to use the gls function. I have single response variable (distance which is continuous) and the explanatory variable is individual ID (class variable: individuals differ in the

[R] incrementing matrix elements more efficiently

2010-08-14 Thread david h shanabrook
I need to increment cells of a matrix (collusionM). The indexes to increment are in an index (matchIndex). This is some of the code for (j in 1:(rows-1)) matchIndex[[j]] - which(mx[j]==mx) for (j in 1:(rows-1)) collisionM[j,matchIndex[[j]]] - collisionM[j,matchIndex[[j]]] + 1

[R] Trouble loading saved Rdata

2010-08-14 Thread steven mosher
In the particular application I have I save test.Rdata to a sub directory dir-Example dir.create(dir) test-data.frame(a=c(1,2,3),b=c(3,4,5) full-file.path(dir,test.Rdata,fsep=.Platform$file.sep) save(test,file=full) load(full) returns NULL it works fine when the object is saved to the working

Re: [R] Trouble loading saved Rdata

2010-08-14 Thread Joshua Wiley
That worked for me once I properly quoted test.RData on sessionInfo() R version 2.11.1 (2010-05-31) x86_64-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United

[R] incrementing matrix elements more efficiently

2010-08-14 Thread david h shanabrook
I need to increment cells of a matrix (collusionM). The indexes to increment are in an index (matchIndex). This is sample code library(seqinr) library(Matrix) x - abcabcabc mx - s2c(x) collisionM - Matrix(0,nrow=10, ncol=10, sparse=TRUE) matchIndex - list() rows -

[R] infinite recursion using anonymous function

2010-08-14 Thread Steven C. Bagley
In R 2.11.1 on Mac OS 10.6.4, the following code works, but if the print statement is removed or commented out, then an infinite recursion results. Can someone explain what is going on? Thanks. --Steve foo2=function(f1, f2){ print(f1) function(x){ f1(x) + f2(x) } } foo=function(...)

Re: [R] infinite recursion using anonymous function

2010-08-14 Thread David Winsemius
On Aug 14, 2010, at 6:23 PM, Steven C. Bagley wrote: In R 2.11.1 on Mac OS 10.6.4, the following code works, but if the print statement is removed or commented out, then an infinite recursion results. Can someone explain what is going on? Thanks. -- Steve foo2=function(f1, f2){

Re: [R] Dealing with data

2010-08-14 Thread Jonathan Christensen
Your second fit makes no sense, as you can easily tell if you look at the regression summaries. Fitting with spray as a categorical variable gives you an overall p-value of less than 2.2e-16, while fitting with as.numeric(spray) gives an overall p-value of .2118. The fit you've done with

[R] band pass filter

2010-08-14 Thread nuncio m
Hello list, Is there any way to bandpass filter in R thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __

Re: [R] band pass filter

2010-08-14 Thread Dennis Murphy
Try this: library(sos) findFn('bandpass') If necessary, install the package first. I got 24 hits in eight packages. Hopefully one or more of them will be suitable. HTH, Dennis On Sat, Aug 14, 2010 at 8:52 PM, nuncio m nunci...@gmail.com wrote: Hello list, Is there any way to

Re: [R] 64 bit RSQLite

2010-08-14 Thread Seth Falcon
Hi Stephen, On 8/12/10 7:10 PM, Stephen Liu wrote: Hi folks, Ubuntu 10.04 64 bit Where can I find 64 bit RSQLite? It seems not there; RSQLite: SQLite interface for R http://cran.r-project.org/web/packages/RSQLite/index.html You should be able to install the RSQLite source package to