[R] background colour

2008-01-13 Thread Daniel Stepputtis
Dear list, I am using R 2.6 on a Windows XP machine. I divided my device window and tried to set the backgroundcolor for each plot region/figure region separately. This seems not possible?? A simple example: # create random numbers a <- rnorm(100) # divide device window par(mfrow=c(1,2)) # set

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Prof Brian Ripley
On Mon, 14 Jan 2008, Mark Wardle wrote: > On 13/01/2008, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: >> No. >> >>> f <- function(a = 3, b = 4) a-b >>> f(b = 10) >> [1] -7 >>> f(b <- 10) >> [1] 6 >> > > I had to go and read (and re-read) the R manual on lexical scope to lexical scope does not co

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Mark Wardle
On 14/01/2008, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Its not related to scoping. f(b = 10) passes 10 as argument b > but f(b <- 10) assigns to variable b (which has nothing to do with > argument b) and then passes the result of the b<-10 expression (which is > 10) to f. Since no argument

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Peter Danenberg
Quoth Mark Wardle on Prickle-Prickle, Chaos 14, 3174: > I can see that f(b <- 10) is equivalent to f(assign("b"), 10)) f(assign("b", 10))? My undestanding is that assign applies to the parental environment; but the return value of assign, namely 10, is passed to f as the local variable a. The de

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Gabor Grothendieck
Its not related to scoping. f(b = 10) passes 10 as argument b but f(b <- 10) assigns to variable b (which has nothing to do with argument b) and then passes the result of the b<-10 expression (which is 10) to f. Since no argument was specified it uses positional matching and the first position is

[R] barplots and missing xlabels

2008-01-13 Thread Geoff Russell
Dear useRs, The following plots only print 2 of the 4 labels under the bars, is there a way please to force all 4 labels to print? par(mfrow=c(1,2),mar=c(2,7,3,1)) dat<-data.frame("AgeGroup"=c("2-15","16-20","21-25","26-39"), "Aorta"=c(20,8,30,60), "Coronary"=c(7,30,55,65)) barplot(dat$Aorta,ylim

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Mark Wardle
On 13/01/2008, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > No. > > > f <- function(a = 3, b = 4) a-b > > f(b = 10) > [1] -7 > > f(b <- 10) > [1] 6 > I had to go and read (and re-read) the R manual on lexical scope to try and understand this since this example highlights a previously neglected

Re: [R] Critical values of r

2008-01-13 Thread C.H.
Not particularly R related, but r related. For pearson correlation, the test statistics is based on t distribution. ts = r * sqrt ((n-2)/(1-r^2)) with n-2 degree of freedom. I think you can solve this question, maybe a little bit of googling. On Jan 14, 2008 1:39 PM, Sanglamt <[EMAIL PROTECTE

Re: [R] a way to interrupt a stuck R session on OSX

2008-01-13 Thread Prof Brian Ripley
On Sun, 13 Jan 2008, Josh Tolley wrote: > On Jan 13, 2008 8:02 PM, Day, Roger S. <[EMAIL PROTECTED]> wrote: >> Discovered by accident: >> >> If your R session has become unresponsive to escape presses etcetera, >> you can try this. >> Open a terminal window, run the command >> >> ps -ax | grep R.a

[R] Critical values of r

2008-01-13 Thread Sanglamt
I've spent several hours trying to track the answer down myself and failed miserably so a simple question for everyone that will no doubt have a painfully obvious answer. What's the command to calculate the critical value of r using a two tailed test with a given alpha and degrees of freedom? I.e

Re: [R] a way to interrupt a stuck R session on OSX

2008-01-13 Thread Josh Tolley
On Jan 13, 2008 8:02 PM, Day, Roger S. <[EMAIL PROTECTED]> wrote: > Discovered by accident: > > If your R session has become unresponsive to escape presses etcetera, > you can try this. > Open a terminal window, run the command > > ps -ax | grep R.app > > Note the process ID number in the first col

Re: [R] arima changes from 2.6.0

2008-01-13 Thread Gad Abraham
Duncan Murdoch wrote: > Gad Abraham wrote: >> Hi, >> >> In 2.6.0 arima() used to return an object with attribute `x' which is >> the observed time series, but this has been dropped from 2.6.1. >> >> This breaks the forecast function in package forecast. >> >> There's no mention of it in the change

Re: [R] arima changes from 2.6.0

2008-01-13 Thread Duncan Murdoch
Gad Abraham wrote: > Hi, > > In 2.6.0 arima() used to return an object with attribute `x' which is > the observed time series, but this has been dropped from 2.6.1. > > This breaks the forecast function in package forecast. > > There's no mention of it in the changelog for 2.6.1. > > Is this a bug

[R] arima changes from 2.6.0

2008-01-13 Thread Gad Abraham
Hi, In 2.6.0 arima() used to return an object with attribute `x' which is the observed time series, but this has been dropped from 2.6.1. This breaks the forecast function in package forecast. There's no mention of it in the changelog for 2.6.1. Is this a bug or a feature? Thanks, Gad -- Ga

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Charilaos Skiadas
And of course let's not forget that a particularly twisted individual could overwrite "=": > `=` <- function(x,y) print(x+y) > 3 = 4 [1] 7 > 3 <- 4 Error in 3 <- 4 : invalid (do_set) left-hand side to assignment I also was for a while mystified by the <- assignment, and preferred = instea

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread S Ellison
.. and don't forget that 6 -> x works but 6 = x won't ... >>> "Gabor Grothendieck" <[EMAIL PROTECTED]> 01/13/08 10:50 PM >>> No. > f <- function(a = 3, b = 4) a-b > f(b = 10) [1] -7 > f(b <- 10) [1] 6 but if you only replace it in the context: x <- ... then it should be ok. On Jan 13, 2008 5:

[R] a way to interrupt a stuck R session on OSX

2008-01-13 Thread Day, Roger S.
Discovered by accident: If your R session has become unresponsive to escape presses etcetera, you can try this. Open a terminal window, run the command ps -ax | grep R.app Note the process ID number in the first column. Say it's 1234. Then run kill -4 1234 The key is that the signal you

Re: [R] Hmisc latex() does not want to work

2008-01-13 Thread Frank E Harrell Jr
Richard M. Heiberger wrote: > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of John Kane > Sent: Sunday, January 13, 2008 03:56 PM > > ## Not run: > latex(x) # creates x.tex in working directory > w <- latex(x, file='/tmp/my.tex') > --

[R] savehistory in OSX version

2008-01-13 Thread Day, Roger S.
Running Version 2.6.0 GUI 1.21. Generally, I enjoy working with the OSX GUI, which has some very pleasant features. Kudos to the developers! There is a nice history panel which slides out of the Console window. The buttons on the panel work as expected. I am puzzled by the behavior of history()

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Jonathan Baron
I think it is worth pointing out that, if you use ESS with (X)emacs, " <- " (with spaces) is produced when you type "_". It requires only two keystrokes (shift and -), and the spaces are done for you. The = sign requires three because you need to type the spaces on each side. Jon ___

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Richard M. Heiberger
Most R users believe that there is a clear distinction between " <- " and "=". Gabor's example is a wonderful illustration of that distinction. Most users recommend " <- " for assignment for greater clarity and readability. The important characteristic for readability is the space on both sides of

Re: [R] Hmisc latex() does not want to work

2008-01-13 Thread Richard M. Heiberger
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Kane Sent: Sunday, January 13, 2008 03:56 PM ## Not run: latex(x) # creates x.tex in working directory w <- latex(x, file='/tmp/my.tex') - I think there

Re: [R] Trying to write Merge for more data.frames - Error in match.names(clabs, names(xi))

2008-01-13 Thread Gabor Grothendieck
Note that the zoo package has a multiway merge for zoo class time series: > library(zoo) as.matrix(do.call(merge, lapply(test, function(x) zoo(unname(x), names(x) A B C D X A "a" "a" NA NA "a" B "b" "b" NA "b" "b" C "c" "c" NA "c" "c" D "d" "d" NA "d" "d" E "e" "e" "e" "e" "e" F

[R] Trying to write Merge for more data.frames - Error in match.names(clabs, names(xi))

2008-01-13 Thread Jiří Voller
Dear list members, I would like to merge multiple dataframes and seems that this task is going to be required quite often, so I decided to write a simple (pseudo)recursive merge. I started with the case when dataframes are merged by rows (0). But there is a problem when a dataframe to be merged in

Re: [R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Gabor Grothendieck
No. > f <- function(a = 3, b = 4) a-b > f(b = 10) [1] -7 > f(b <- 10) [1] 6 but if you only replace it in the context: x <- ... then it should be ok. On Jan 13, 2008 5:41 PM, Nasser Abbasi <[EMAIL PROTECTED]> wrote: > hi; > > When I first started looking at R code, I thought that the <- notati

[R] is it safe to replace every "<-" by "=" in R code?

2008-01-13 Thread Nasser Abbasi
hi; When I first started looking at R code, I thought that the <- notation for assignment made the code less readable (and I still do). Then I found that now one can use "=" in place of "<-" for assignment (I understand this started since version 1.4). Anyway, I think using "=" makes the code

Re: [R] Lattice equivalent of par(mfrow = )

2008-01-13 Thread Deepayan Sarkar
On 1/13/08, Michael Kubovy <[EMAIL PROTECTED]> wrote: > Dear R-helpers, > > On Jan 12, 2008, at 5:17 PM, Deepayan Sarkar wrote: > > > On 1/12/08, Michael Kubovy <[EMAIL PROTECTED]> wrote: > >> Dear r-helpers, > >> > >> Does anyone have a straightforward example of putting together three > >> unrela

Re: [R] For Loop performance

2008-01-13 Thread mcoyne
Hi Uwe, Thank you so much for your help. It works great with your suggestion/help. WOW, what a difference! --MyC > > > [EMAIL PROTECTED] wrote: >> WRT: Say length(V1) is n, do you want to compare >>> v1[1] with v2[1] and v2[2] and v1[2] with v2[3] and v2[4] >>> or >>> v1[1] with v2[1] and v2[n

Re: [R] Hmisc latex() does not want to work

2008-01-13 Thread Frank E Harrell Jr
John Kane wrote: > Thank Frank, > > I simply seem to have misread part of the first > example > -- > x <- matrix(1:6, nrow=2, > dimnames=list(c('a','b'),c('c','d','enLine 2'))) > ## Not run: > latex(x) # creates x.tex in working directory > w <

Re: [R] Shapiro-Wilk

2008-01-13 Thread Benilton Carvalho
first hit on google: http://en.wikipedia.org/wiki/Shapiro-Wilk_test =) b On Jan 13, 2008, at 4:01 PM, [EMAIL PROTECTED] wrote: What is the formula used in Shapiro-Wilk Statistic? Thanks Eduardo (São Paulo/ Brazil) __ R-help@r-project.org mailing l

[R] Shapiro-Wilk

2008-01-13 Thread hoehne
What is the formula used in Shapiro-Wilk Statistic? Thanks Eduardo (São Paulo/ Brazil) __ 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-guide.html and pr

Re: [R] Hmisc latex() does not want to work

2008-01-13 Thread John Kane
Thank Frank, I simply seem to have misread part of the first example -- x <- matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','enLine 2'))) ## Not run: latex(x) # creates x.tex in working directory w <- latex(x, file='/tmp/my.tex') --

Re: [R] Hmisc latex() does not want to work

2008-01-13 Thread Frank E Harrell Jr
John Kane wrote: > Works just fine, thanks. I'll blame the help as > being very slightly ambiguous. From the help file: \section{Side Effects}{ creates various system files and runs various Linux/UNIX system commands which are assumed to be in the system path. } \details{ If running unde

Re: [R] For Loop performance

2008-01-13 Thread Uwe Ligges
[EMAIL PROTECTED] wrote: > WRT: Say length(V1) is n, do you want to compare >> v1[1] with v2[1] and v2[2] and v1[2] with v2[3] and v2[4] >> or >> v1[1] with v2[1] and v2[n+1] and v1[2] with v2[2] and v2[n+2] > > v1[1] with (v2[1] and v2[2]) > v1[2] with (v2[3] and v2[4]) > v1[3] with (v2[5] and

Re: [R] For Loop performance

2008-01-13 Thread mcoyne
WRT: Say length(V1) is n, do you want to compare > v1[1] with v2[1] and v2[2] and v1[2] with v2[3] and v2[4] > or > v1[1] with v2[1] and v2[n+1] and v1[2] with v2[2] and v2[n+2] v1[1] with (v2[1] and v2[2]) v1[2] with (v2[3] and v2[4]) v1[3] with (v2[5] and v2[6]) ... v1[n] with (v2[n+1] an

Re: [R] Hmisc latex() does not want to work

2008-01-13 Thread John Kane
Works just fine, thanks. I'll blame the help as being very slightly ambiguous. Of course another 2-3 minutes experimenting and I should have gotten it. --- Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Try specifying the file= argument: > > latex(rr, file = "") > > On Jan 13, 2008 1:05

Re: [R] For Loop performance

2008-01-13 Thread Uwe Ligges
My Coyne wrote: > Hello, > > > > Newbie question and hope you can help . > > I have two vector V1 and V2, where length(V2) = length of (V1) * 2; > length(V1) ~ 16,000. > > For each member in V1, I need to compare 2 element of V2 for equality If just the comparison is concerned, you can do

[R] For Loop performance

2008-01-13 Thread My Coyne
Hello, Newbie question and hope you can help . I have two vector V1 and V2, where length(V2) = length of (V1) * 2; length(V1) ~ 16,000. For each member in V1, I need to compare 2 element of V2 for equality i.e. for (I in 1:length (V1)) { if ( v2[i] == v1[i] & v2[i+1]==v1[i] ){

Re: [R] Hmisc latex() does not want to work

2008-01-13 Thread Gabor Grothendieck
Try specifying the file= argument: latex(rr, file = "") On Jan 13, 2008 1:05 PM, John Kane <[EMAIL PROTECTED]> wrote: > I seem to have a problem getting latex (Hmisc) to > work. > Any suggestions as to what I am doing wrong? > > Thanks > > > library(Hmisc) > aa <- data.frame(aa=1:10, bb=rnorm(10,

[R] Hmisc latex() does not want to work

2008-01-13 Thread John Kane
I seem to have a problem getting latex (Hmisc) to work. Any suggestions as to what I am doing wrong? Thanks library(Hmisc) aa <- data.frame(aa=1:10, bb=rnorm(10, 5, 2), cc=rnorm(10, 20, 4)) rr <- lm(cc~aa+bb, data=aa); rr latex(rr) > latex(rr) 'latex' is not recognized as an internal or externa

[R] bug in mmlcr ?

2008-01-13 Thread Christophe Genolini
Hi the list. Is there a bug in mmlcr package ? The following code does not compile: mmlcrTest <- function(dataW){ dataL <- reshape(dataW,idvar="id",timevar="T",varying=list(paste("T",0:10,sep="")),direction="long",v.names="score") resultR <- mmlcr(outer= ~ 1 | id, compo

Re: [R] glm expand model to more values

2008-01-13 Thread Jarek Jasiewicz
Henric Nilsson (Public) wrote: > Jarek Jasiewicz wrote: >> Charles Annis, P.E. wrote: >>> Jarek: >>> >>> Although it is not universally agreed on, I believe the first step >>> in any >>> data analysis is to PLOT YOUR DATA. >>> >>> dd <- data.frame(a=c(1, 2, 3, 4, 5, 6), b=c(3, 5, 6, 7, 9, 10))

Re: [R] access to webpage code

2008-01-13 Thread Prof Brian Ripley
See ?download.file ?url Omegahat package RCurl You do realize that the 'code of web page' is just what you download? E.g. (working example) readLines(url("http://www.r-project.org";)) On Sun, 13 Jan 2008, John Lande wrote: > dear R user, > > I need a function that download the code of web pa

Re: [R] Retrieve only part of a matrix

2008-01-13 Thread John Kane
mymatrix <- oldmatrix[1:271,4:19000] --- My Coyne <[EMAIL PROTECTED]> wrote: > Hi All, > > I'm new with R; this is a basic question. I was > given a matrix I of (nrow, > ncol), I would like to create another matrix A with > some data in the matrix > I, say [1,4] (row 1, column 4) to [271,19000]

Re: [R] glm expand model to more values

2008-01-13 Thread Henric Nilsson (Public)
Jarek Jasiewicz wrote: > Charles Annis, P.E. wrote: >> Jarek: >> >> Although it is not universally agreed on, I believe the first step in any >> data analysis is to PLOT YOUR DATA. >> >> dd <- data.frame(a=c(1, 2, 3, 4, 5, 6), b=c(3, 5, 6, 7, 9, 10)) >> plot(b ~ a, data=dd) >> simple.model <- l

Re: [R] access to webpage code

2008-01-13 Thread Henrique Dallazuanna
Try this: code <- readLines(site) On 13/01/2008, John Lande <[EMAIL PROTECTED]> wrote: > dear R user, > > I need a function that download the code of web page as html, to further > parse it. > > something like > > >site="http://www.R-project.com"; > >code=function(site) > >code > > !DOCTYPE HTML

[R] access to webpage code

2008-01-13 Thread John Lande
dear R user, I need a function that download the code of web page as html, to further parse it. something like >site="http://www.R-project.com"; >code=function(site) >code !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> The R Project for Statistical Computing The R

Re: [R] Newbie syntax question

2008-01-13 Thread Peter Dalgaard
jim holtman wrote: > ?cor.test > > and the help page says: > > formula: a formula of the form ~ u + v, where each of u and v are > numeric variables giving the data values for one sample. The samples > must be of the same length. > Yes, but does that answer the question? Seems to me that Joe k

Re: [R] odfWeave and xtable

2008-01-13 Thread 宋时歌
Thanks, Frank. The clarification as well as the referred resources are extremely helpful. Shige On Jan 13, 2008 10:14 PM, Frank E Harrell Jr <[EMAIL PROTECTED]> wrote: > 宋时歌 wrote: > > Hi Frank, > > > > I use Hmisc and Design in my research a lot, the LaTeX facilities are > > very handy. But I do

Re: [R] Lattice equivalent of par(mfrow = )

2008-01-13 Thread jim holtman
You need to make sure all your xlab's are the same size. Try: states <- data.frame(state.x77, state.name = dimnames(state.x77)[[1]], state.region = state.region) plot1 <- xyplot(Murder ~ Population, data = states, xlab = grid::textGrob(expression(f

Re: [R] Retrieve only part of a matrix

2008-01-13 Thread Henrique Dallazuanna
Try this: A <- I[1:271, 4:19000] On 13/01/2008, My Coyne <[EMAIL PROTECTED]> wrote: > Hi All, > > I'm new with R; this is a basic question. I was given a matrix I of (nrow, > ncol), I would like to create another matrix A with some data in the matrix > I, say [1,4] (row 1, column 4) to [271,1900

Re: [R] odfWeave and xtable

2008-01-13 Thread Frank E Harrell Jr
宋时歌 wrote: > Hi Frank, > > I use Hmisc and Design in my research a lot, the LaTeX facilities are > very handy. But I don't think they can work with OpenOffice document > format (ODF), or did I miss something? > > Thanks. > > Shige You're correct. Conversion from LaTeX to OpenOffice or Word is

[R] Retrieve only part of a matrix

2008-01-13 Thread My Coyne
Hi All, I'm new with R; this is a basic question. I was given a matrix I of (nrow, ncol), I would like to create another matrix A with some data in the matrix I, say [1,4] (row 1, column 4) to [271,19000] (row 271, column 19000). How do I do this? Please help. Thank you very much. --mc

Re: [R] question about xreg of arima

2008-01-13 Thread tom soyer
Thanks Richard. I am just trying to understand exactly what is R's arima doing, and I am having a hard time. It seems that xreg is necessary to force arima to include the constant term, but it appears that exactly how this is done is not documented. If a series is not differenced, e.g. AR(1), then

[R] Merci de confirmer votre désinscription

2008-01-13 Thread Isabelle
Quelqu'un, certainement vous, a demandé votre désinscription de cette lettre d'info, merci de suivre les informations qui suivent. Pour vous désinscrire, cliquez sur le lien suivant : http://www.smt-online.com/newsletters/subscription.php?op=confirm_leave&email_addr=r-help%40stat.math.ethz.ch&has

Re: [R] question regarding hypothesis testing in contingency tables

2008-01-13 Thread Bernardo Rangel Tura
On Thu, 2008-01-10 at 09:47 -0800, eugen pircalabelu wrote: > Hi R-users! > > I have the following example: > a<-data.frame(cat=c(5,10,15), dog=c(5,10, 15), mouse=c(10,10,20)) > b<-data.frame(cat=c(15,10,5), dog=c(15, 10, 5), mouse=c(20,10,10)) > rownames(b)<-c("scared", "happy", "sad") > rowname

Re: [R] Lattice equivalent of par(mfrow = )

2008-01-13 Thread Michael Kubovy
Dear R-helpers, On Jan 12, 2008, at 5:17 PM, Deepayan Sarkar wrote: > On 1/12/08, Michael Kubovy <[EMAIL PROTECTED]> wrote: >> Dear r-helpers, >> >> Does anyone have a straightforward example of putting together three >> unrelated (expect for a common y-axis) xyplot() figures in what would >> be

[R] Bonne année 2008

2008-01-13 Thread Isabelle
Si ce message ne s'affiche pas correctement [1]cliquez ici [2] [logotype.gif] Toute l'équipe de [3]PUXOU.fr vous souhaite une bonne et heureuse année 2008 Que cette nouvelle année soit pour vous l'année de toutes vos réus

[R] Multiple correspondence analysis

2008-01-13 Thread Bernardo Rangel Tura
Hi R-people, I try using mca (multiple correspondence analysis) in evocation data (data base feminino2.csv attach in this mail). Well in this database have 4 evocations for each 120 persons. If I use this script: base<-read.csv("feminino2.csv") require(MASS) plot(mca(base,abbrev=T),rows = F)

Re: [R] odfWeave and xtable

2008-01-13 Thread 宋时歌
Hi Frank, I use Hmisc and Design in my research a lot, the LaTeX facilities are very handy. But I don't think they can work with OpenOffice document format (ODF), or did I miss something? Thanks. Shige On Jan 13, 2008 2:03 AM, Frank E Harrell Jr <[EMAIL PROTECTED]> wrote: > > ??? wrote: > > Dea