[R] Extracting variables with a given prefix in the parent environment

2008-10-20 Thread erwann rogard
hi, get.vars.name.prefix-function(prefix){ result-list() len-nchar(prefix) var.names-ls(name=1,pattern=prefix) #name=1 probably wrong option print(var.names) for(i in 1:length(var.names)){ name-var.names[i] field-substr(name,len+1,nchar(name)) result[[field]]-get(name) } result }

[R] logreg2 message

2008-10-20 Thread Αργυρώ Ανταράκη
Hello, I have run imp - mice(data,im=c(,pmm,logreg,logreg2),m=10,seed=0) and I got the message  iter imp variable   1   1  AGE  FAMILYBREASTHISTORY  PARITYError in mice.impute.logreg2(c(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  :   mice.impute.logreg2 is disabled this release In addition:

[R] convert matrix to dataframe with repeating row names

2008-10-20 Thread Ravi S. Shankar
Hi R, I have a matrix x with repeating row names. dim(x) [1] 862 19 zz-matrix(0,4,4) rownames(zz)=c(a,a,b,b) data.frame(zz) (?) I need to use x in a linear regression lm(as.formula(paste(final_dat[,5]~,paste(colnames(x),collapse=+))),x ) this gives me a error Error in

Re: [R] Select only cases with negative values

2008-10-20 Thread Martin Maechler
MJ == Michael Just [EMAIL PROTECTED] on Sat, 18 Oct 2008 17:26:02 -0400 writes: MJ Henrique, MJ This code below from a R-help helper worked. dat -data.frame(f) dat2-dat[dat$d0,] dat.lm -lm(c~d, data=dat2) But Henrique's advice, of using 'subset= d 0' was really

[R] About Torus Rndamiztion

2008-10-20 Thread Surendra champanerkar
Hallo I am going through the paper on Torus randomization by Kyle E. Harms torus randomization is an alternative to Chi-sq test of Independence When the assumption of independence within the groups is violated i want to know that Is there any library regarding torus randomization Someone said me

Re: [R] about granova library

2008-10-20 Thread Bernardo Rangel Tura
Em Qui, 2008-10-16 às 21:11 +1030, Fernando Marmolejo Ramos escreveu: Dear all Recently the granova package was launched. I installed but after when I invoked it in R it requested for other libraries. They were downloaded and install automatically. I tried to run the example syntax of

[R] A question about positive definite matrix

2008-10-20 Thread rlearner309
I know, this is a forum about R. But I am so desperate of this problem (BTW, anyone knows any good Statistics/Math forum to post question like this?): A and B are both n x n positive definite matrix. Denote A B, if A - B is positive definite. I know this is true: if A B, then A^{-1} B^{-1}.

[R] R 2.8.0 is released

2008-10-20 Thread Peter Dalgaard
I've rolled up R-2.8.0.tar.gz a short while ago. This is a development release which contains a number of new features. Also, a number of mostly minor bugs have been fixed. See the full list of changes below. You can get it (later today) from

Re: [R] convert matrix to dataframe with repeating row names

2008-10-20 Thread Prof Brian Ripley
On Mon, 20 Oct 2008, [EMAIL PROTECTED] wrote: I have a matrix x with repeating row names. zz-matrix(0,4,4) rownames(zz)=c(a,a,b,b) data.frame(zz) (?) The row names on a data frame should be unique. You can try as.data.frame(xx, row.names=FALSE) to convert zz to be a data frame. If you

[R] Bootstrap problem

2008-10-20 Thread Tom Willems
Dear R-users, I'm having a small problem while bootstraping data. What i would like to do, is resmple the data and calulate a function on this, so i can estimate the measure of reproducability for this data. The function i wrote works fine, even while bootstraping. The only problem is that

Re: [R] Extracting variables with a given prefix in the parent environment

2008-10-20 Thread Duncan Murdoch
On 20/10/2008 2:06 AM, erwann rogard wrote: hi, get.vars.name.prefix-function(prefix){ result-list() len-nchar(prefix) var.names-ls(name=1,pattern=prefix) #name=1 probably wrong option print(var.names) for(i in 1:length(var.names)){ name-var.names[i]

Re: [R] convert matrix to dataframe with repeating row names

2008-10-20 Thread Richard . Cotton
The row names on a data frame should be unique. You can try as.data.frame(xx, row.names=FALSE) to convert zz to be a data frame. If you need the row name information, add it as a column in the data frame, e.g. mydataframe$rnames - rownames(zz). (Note to R-Core: the documentation for

[R] Error reporting in R

2008-10-20 Thread A.Noufaily
Hello, I am hoping someone can help me with the following: I am applying the function mle on a single data set X n times, each time using a different set of initial values v[i] (i=1,...,n). The initial values are all finite. Two cases arise: A- For some sets of initial values mle is giving

Re: [R] pairs plots in R

2008-10-20 Thread Antony Unwin
If you want to do efficient exploratory data analysis on this kind of dataset, then interactive graphics with parallel coordinate plots (ipcp in iplots) should help. Of course, it depends what you mean by large. It might be worth looking at the book Graphics of Large Datasets for some

Re: [R] Extracting variables with a given prefix in the parent environment

2008-10-20 Thread Henrique Dallazuanna
Try this: Using 'envir' argument, in ls and get function: get.vars.name.prefix-function(prefix, envir = parent.frame()){ result-list() len-nchar(prefix) var.names-ls(envir = envir,pattern=prefix) print(var.names) for(i in 1:length(var.names)){ name-var.names[i]

[R] problem with multiple comparison

2008-10-20 Thread Patrice KOUAKOU
Dear all, I'm a new user of R. How to manage R to have homogeneous means groups with Duncan test? I've tried the Duncan test and the results is the difference between means taken in pairs. Patrice __ ble contre les messages non sollicités

[R] Trying to pass arrays as arguments to a function

2008-10-20 Thread Kåre Edvardsen
I'd like to avoid looping through an array in order to change values in the array as it takes too long. I red from an earlier post it can be done by do.call but never got it to work. The Idea is to change the value of y according to values in x. Wherever x holds the value 3, the corresponding

Re: [R] Trying to pass arrays as arguments to a function

2008-10-20 Thread Kaom Te
y - ifelse(x == 3, 1, y) -Kaom On Oct 20, 2008, at 6:07 AM, Kåre Edvardsen wrote: I'd like to avoid looping through an array in order to change values in the array as it takes too long. I red from an earlier post it can be done by do.call but never got it to work. The Idea is to change

Re: [R] Trying to pass arrays as arguments to a function

2008-10-20 Thread Philipp Pagel
On Mon, Oct 20, 2008 at 03:07:45PM +0200, Kåre Edvardsen wrote: I'd like to avoid looping through an array in order to change values in the array as it takes too long. I red from an earlier post it can be done by do.call but never got it to work. The Idea is to change the value of y according

Re: [R] Trying to pass arrays as arguments to a function

2008-10-20 Thread Claudia Beleites
I'd like to avoid looping through an array in order to change values in the array as it takes too long. I red from an earlier post it can be done by do.call but never got it to work. The Idea is to change the value of y according to values in x. Wherever x holds the value 3, the corresponding

Re: [R] Dep setting for install of packages... EOT (I think) and my thanks

2008-10-20 Thread Brian Lunergan
Gabor Grothendieck wrote: leaps is not in Depends or Imports for car. It is in Suggests and those don't get automatically pulled in when dependencies = NA. What you could do is to replace the builtin menuInstallPkgs with your own by running this: assignInNamespace(menuInstallPkgs, function

Re: [R] Date classes in ggplot2

2008-10-20 Thread Thompson, David (MNR)
Is not melt part of reshape package, i.e., require(reshape)? DaveT. -Original Message- From: stephen sefick [mailto:[EMAIL PROTECTED] Sent: October 19, 2008 12:12 PM To: hadley wickham Cc: R Help Subject: Re: [R] Date classes in ggplot2 well I must have either resolve it without

Re: [R] Date classes in ggplot2

2008-10-20 Thread stephen sefick
yes it is, I meant without the clutter of my previous analyses - reshape is required by ggplot2 so I had that covered... If I am understanding you correctly. thanks for all of the help, Stephen On Mon, Oct 20, 2008 at 9:39 AM, Thompson, David (MNR) [EMAIL PROTECTED] wrote: Is not melt part of

[R] [R-pkgs] New verion 0.3-7 of gsubfn package

2008-10-20 Thread Gabor Grothendieck
Version 0.3-7 of the gsubfn package is available on CRAN. Changes to the package are: - all known bugs have been fixed. - in gsubfn and strapply the replacement object can be a list (or a function, formula, character string or proto object, as before). In the case of a list, regexp matches

Re: [R] pairs plots in R

2008-10-20 Thread Sharma, Dhruv
Thanks Felix. Regards, Dhruv -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Felix Andrews Sent: Sunday, October 19, 2008 11:37 PM To: Sharma, Dhruv Cc: r-help@r-project.org Subject: Re: [R] pairs plots in R One idea: if the primary variable of

Re: [R] Dep setting for install of packages... EOT (I think) and my thanks

2008-10-20 Thread Gabor Grothendieck
You can put the code on several lines as shown or on one line. Does not matter. Read the info on the dependencies= arg in ?install.packages for the definitive explanation of how dependencies= works. On Mon, Oct 20, 2008 at 9:32 AM, Brian Lunergan [EMAIL PROTECTED] wrote: Gabor Grothendieck

Re: [R] pairs plots in R

2008-10-20 Thread Sharma, Dhruv
thanks Antony. regards, Dhruv From: Antony Unwin [mailto:[EMAIL PROTECTED] Sent: Monday, October 20, 2008 7:00 AM To: r-help@r-project.org Cc: Sharma, Dhruv Subject: Re: [R] pairs plots in R If you want to do efficient exploratory data analysis on this kind

[R] Package Deal

2008-10-20 Thread Leandro Marino
Hi, I was trying to adjust an bayesian network with Deal package. I know how to adjust when I give the structure and when I don't give the struture. Now, I want to adjust when I know some variables relationships and others I don't know. Anybody knows how can I do that? Regards,

Re: [R] Error reporting in R

2008-10-20 Thread Duncan Murdoch
On 20/10/2008 5:39 AM, A.Noufaily wrote: Hello, I am hoping someone can help me with the following: I am applying the function mle on a single data set X n times, each time using a different set of initial values v[i] (i=1,...,n). The initial values are all finite. Two cases arise: A- For some

Re: [R] The evaluation of optional function arguments

2008-10-20 Thread Sietse Brouwer
Hullo all, [***recap of the question: passing bar=harry fails when bar is among the ... args.] callTimes - function(tom, harry) { timesDefineInside(foo=tom, bar=harry } timesDefineInside - function(foo, ...) { foo * bar } callTimes(3, 4) # Error: object bar not found [***end

[R] Combining all possible values of variables into a new...

2008-10-20 Thread stefan . petersson
I'm trying to create a new column in my data.frame where subjects are categorized depending on values on four other columns. In any other case I would just nest a few ifelse statements, however, in this case i have 4*6*2*3=144 combinations and i get weird 'context overflow' errors. So I wonder

Re: [R] Combining all possible values of variables into a new...

2008-10-20 Thread Dimitris Rizopoulos
try this: x - c(1,0,0,1,0,0,1,0,0,1) y - c(1,3,2,3,2,1,2,3,2,3) z - c(1,2,1,2,1,2,1,2,1,2) d - data.frame(x, y, z) ind - do.call(paste, c(expand.grid(1:2, 1:3, 0:1)[3:1], sep = \r)) trg - do.call(paste, c(d, sep = \r)) d$myvar - match(trg, ind) I hope it helps. Best, Dimitris [EMAIL

Re: [R] use of empty space in split graph device

2008-10-20 Thread Benoit Boulinguiez
That's it. thanks Regards/Cordialement Benoit Boulinguiez -Message d'origine- De : Greg Snow [mailto:[EMAIL PROTECTED] Envoyé : vendredi 17 octobre 2008 19:19 À : Benoit Boulinguiez; r-help@r-project.org Objet : RE: [R] use of empty space in split graph device The plot.new

Re: [R] convert matrix to dataframe with repeating row names

2008-10-20 Thread Richard . Cotton
I have a matrix x with repeating row names. zz-matrix(0,4,4) rownames(zz)=c(a,a,b,b) data.frame(zz) (?) The row names on a data frame should be unique. You can try as.data.frame(xx, row.names=FALSE) to convert zz to be a data frame. If you need the row name information, add it as a

Re: [R] Combining all possible values of variables into a new...

2008-10-20 Thread David Hajage
or if x, y and z are factors : dbis - as.data.frame(apply(d, 2, as.factor) dbis$x:dbis$y:dbis$z [1] 1:1:1 0:3:2 0:2:1 1:3:2 0:2:1 0:1:2 1:2:1 0:3:2 0:2:1 1:3:2 12 Levels: 0:1:1 0:1:2 0:2:1 0:2:2 0:3:1 0:3:2 1:1:1 1:1:2 1:2:1 ... 1:3:2 and for your results : as.numeric(dbis$x:dbis$y:dbis$z)

Re: [R] Calculate SPE in PLS package

2008-10-20 Thread Bjørn-Helge Mevik
Stella Sim [EMAIL PROTECTED] writes: I want to calculate SPE (squared prediction error) in x-space, can someone help? Here are my codes: fit.pls- plsr(Y~X,data=DAT,ncomp=3,scale=T,method='oscorespls',validation=CV,x= T) actual-fit.pls$model$X (The x = TRUE is not needed as long as

Re: [R] Combining all possible values of variables into a new...

2008-10-20 Thread Gustaf Rydevik
On Mon, Oct 20, 2008 at 4:10 PM, [EMAIL PROTECTED] wrote: I'm trying to create a new column in my data.frame where subjects are categorized depending on values on four other columns. In any other case I would just nest a few ifelse statements, however, in this case i have 4*6*2*3=144

[R] Odp: Combining all possible values of variables into a new...

2008-10-20 Thread Petr PIKAL
Hi maybe you can change combination of your columns to factor new -factor(paste(x,y,z, sep=)) and then reorder this factor (see reorder) change it to numeric to get index index - as.numeric(factor) and then choose from set of 144 data data[index] or use your index directly if you need

Re: [R] Extracting variables with a given prefix in the parent environment

2008-10-20 Thread erwann rogard
Thank you all for your answers. On Mon, Oct 20, 2008 at 6:32 AM, Henrique Dallazuanna [EMAIL PROTECTED]wrote: Try this: Using 'envir' argument, in ls and get function: get.vars.name.prefix-function(prefix, envir = parent.frame()){ result-list() len-nchar(prefix)

[R] Row Sampling

2008-10-20 Thread Alex99
Hi everyone, does any one knows how can I make sample from rows? i.e. I have a data like this: s1 s2 s3 s4 1 0 0 0 1 2 1 0 1 0 3 0 0 0 0 4 0 0 0 0 5 0 1 0 1 6 1 0 0 0 7 0 0 0 0 8 0 0 0 0 9 0 0 0 0 10 0 0 0 1 I need to make 5 different sample

[R] How to get estimate of confidence interval?

2008-10-20 Thread Ted Byers
I thought I was finished, having gotten everything to work as intended. This is a model of risk, and the short term forecasts look very good, given the data collected after the estimates are produced (this model is intended to be executed daily, to give a continuing picture of our risk). But

[R] Zero mean correlation Matrix

2008-10-20 Thread AliR
Hi,, I want to use the existing cor function in R but with a different way to compute the correlation method.. basically zero mean correlation. The forumula I have is 'D' - function(c1, c2) sum(c1*c2, na.rm=T)/(sqrt(sum(c1*c1, na.rm=T))*sqrt(sum(c2*c2, na.rm=T))) I am not sure how i can

[R] slow graphics download

2008-10-20 Thread Paul Murtaugh
Hi, I often work from home, running R on my office computer and displaying interactive graphics on my home computer using X11. This was always more sluggish than sitting at my office computer, obviously, but recently the graphics transfer has become painfully slow -- so slow, that I now

[R] folded normal distribution in R

2008-10-20 Thread Andreas Wittmann
Dear R useRs, i wanted to ask if the folded normal destribution (Y = abs(X) with X normal distributed) with density and random number generator is implemented in R or in any R-related package so far? Maybe i can use the non-central chi-square distribution and rchisq(n, df=1, ncp0) here?

Re: [R] slow graphics download

2008-10-20 Thread Prof Brian Ripley
I suspect that you need to set the type= in X11(): see its help page. E.g. 'type = nbcairo' is the same device as 'type=cairo' without buffering: which is faster will depend on the X11 connection. Both will be slower than 'type = Xlib', especially on a slow X11 connection as

Re: [R] folded normal distribution in R

2008-10-20 Thread Matthias Kohl
Dear Andreas, try: library(distr) X - Norm() ## standard normal distribution Y - abs(X) plot(Y) Best regards, Matthias Andreas Wittmann wrote: Dear R useRs, i wanted to ask if the folded normal destribution (Y = abs(X) with X normal distributed) with density and random number generator is

Re: [R] folded normal distribution in R

2008-10-20 Thread Prof Brian Ripley
It's trivial to do. In particular abs(rnorm(...)) will give you the random number generator. The term 'folded normal distribution' is normally only used for mean=0, when you just double the density, but the general result is ifelse(x 0, 1, 0) * (dnorm(x, ...) + dnorm(-x, ...)) On Mon, 20

[R] R Newbie Question

2008-10-20 Thread Johannes Bauer
Hello list, I just started R today and tried something quite simple. I wanted to create a colored plot and eventually after hours of fiddling around got it working. However, my solution seems very suboptimal and I'd really appreciate your hints on how to improve. I believe that R already offers

[R] pass longer arguments to adj of text()

2008-10-20 Thread Thomas Steiner
Hi, text()'s pos does handle more dimensional labels, while adj does not - or how can I pass an array to text() and use the adj argument (skyblue text)? plot(-1:1,-1:1) text(c(0,0),c(0,0),c(a,b),pos=c(1,2),col=red) text(c(0,0),c(0,0),c(a,b),adj=cbind(c(1,2),c(1,1)),col=skyblue) Thomas

[R] error message when plotting survival curves

2008-10-20 Thread A Van Dyke
I am trying to plot survival curves using the following code as an example: rs1799964.coxph-(coxph(Surv(sassurvmonths,status)~age+stage+rs1799964_TNFA,method=efron)) plot(rs1799964.coxph,lyt=c(1,3),xlab=Survival in Months,ylab=Proportion Surviving) I am gettingthe following error message:

[R] distributions and glm

2008-10-20 Thread drbn
Hello, I have seen that some papers do this: 1.) Group data by year (e.g. 35 years) 2.) Estimate the mean of the key variable through the distribution that fits better (some years is a normal distribution , others is a more skewed, gamma distribution, etc.) 3.) With these estimated means of

[R] calculating mean for samples

2008-10-20 Thread Alex99
Hi everyone, does any one knows how can I calculate mean for different samples i.e. I have a data like this: s1 s2 s3 s4 1 0 0 0 1 2 1 0 1 0 3 0 0 0 0 4 0 0 0 0 5 0 1 0 1 6 1 0 0 0 7 0 0 0 0 8 0 0 0 0 9 0 0 0 0 10 0 0 0 1 I need to

[R] Staging area for data before read into R

2008-10-20 Thread stephen sefick
I am wondering if there is a better alternative than Excel for data storage that does not require database knowledge (I will eventually have to learn this, but it is not on my immediate todo list). I need something that is not limited to 256 columns... I don't need any of the built in functions

Re: [R] error message when plotting survival curves

2008-10-20 Thread stephen sefick
I believe that you have to specify which variable is the x and also the y. I am not familiar with what you are doing, but it looks as though you need to specify both x and y to get it to plot. Stephen On Mon, Oct 20, 2008 at 2:22 PM, A Van Dyke [EMAIL PROTECTED] wrote: I am trying to plot

Re: [R] R Newbie Question

2008-10-20 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Johannes Bauer Sent: Monday, October 20, 2008 10:42 AM To: r-help@r-project.org Subject: [R] R Newbie Question Hello list, I just started R today and tried something quite simple. I wanted to

Re: [R] calculating mean for samples

2008-10-20 Thread stephen sefick
assuming that A1 is the data provided in the first post... it would be helpful if you used dput() to copy into an email, so that we could just copy the code and data right into a R session and be off and running. I hope this helps. #I used dput() on the object A1 A1 - (structure(list(s1 = c(0L,

Re: [R] pass longer arguments to adj of text()

2008-10-20 Thread Thomas Steiner
...and the offset argument can't handle arrays either: text(c(0,0),c(0,0),c(a,b),pos=c(1,2),offset=c(1,0.5),col=darkgreen) The second argument does not have any effect. Can I pass arrays to text and use diffent locations? Thomas PS: I use R version 2.5.0 (2007-04-23) under Win2000.

Re: [R] Staging area for data before read into R

2008-10-20 Thread stephen sefick
sorry excel 2003 with no immediate update in the future. On Mon, Oct 20, 2008 at 3:12 PM, Gabor Grothendieck [EMAIL PROTECTED] wrote: You didn't say which version of Excel you are using but Excel 2007 allows 16,384 columns. On Mon, Oct 20, 2008 at 2:27 PM, stephen sefick [EMAIL PROTECTED]

Re: [R] error message when plotting survival curves

2008-10-20 Thread Thomas Lumley
On Mon, 20 Oct 2008, A Van Dyke wrote: I am trying to plot survival curves using the following code as an example: rs1799964.coxph-(coxph(Surv(sassurvmonths,status)~age+stage+rs1799964_TNFA,method=efron)) plot(rs1799964.coxph,lyt=c(1,3),xlab=Survival in Months,ylab=Proportion Surviving)

Re: [R] par(mfrow=c(2,4))

2008-10-20 Thread stephen sefick
reproducible code please. On Mon, Oct 20, 2008 at 3:22 PM, phoebe kong [EMAIL PROTECTED] wrote: Hi All, I'm going to draw 8 plots in one page. I want the plots to be arranged in two rows, each row has 4 plots. So, I set the it par(mfrow=c(2,4)). However, there might be too many plots in a

Re: [R] R 2.8.0 is released

2008-10-20 Thread Jeroen Ooms
I'm getting a unexpected compiling error when doing make: gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -fpic -g -O2 -c platform.c -o platform.o platform.c: In function

Re: [R] R 2.8.0 is released

2008-10-20 Thread Jeroen Ooms
I'm getting a unexpected compiling error when doing make: gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -fpic -g -O2 -c platform.c -o platform.o platform.c: In function

Re: [R] pass longer arguments to adj of text()

2008-10-20 Thread Thomas Steiner
Brian, thank you for your reply. Why do you expect this to be vectorized when the help page clearly says otherwise? Sure, it's in line with the help, no problem there. I just asked if this feature is somehow possible. I expected it, because pos does take arrays and it overrides any adj value

Re: [R] R 2.8.0 is released

2008-10-20 Thread Duncan Murdoch
On 10/20/2008 4:34 PM, Jeroen Ooms wrote: I'm getting a unexpected compiling error when doing make: gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -fpic -g -O2 -c

Re: [R] Staging area for data before read into R

2008-10-20 Thread Ted Byers
Define better. Really, it depends on what you need to do (are all your data appropriately represented in a 2D array?) and what resources are available. If all your data can be represented using a 2D array, then Excel is probably your best bet for th enear term. If not, you might as well bite

Re: [R] About Torus Rndamiztion

2008-10-20 Thread Ben Bolker
Surendra champanerkar surendrachampanerkar at gmail.com writes: Hallo I am going through the paper on Torus randomization by Kyle E. Harms torus randomization is an alternative to Chi-sq test of Independence When the assumption of independence within the groups is violated i want to know

Re: [R] pass longer arguments to adj of text()

2008-10-20 Thread Peter Dalgaard
Thomas Steiner wrote: NB: library(fortunes); fortune(WTFM) applies. This one I didn't get. They help to do it without a loop? No. library(fortunes); fortune(WTFM) This is all documented in TFM. Those who WTFM don't want to have to WTFM again on the mailing list. RTFM. -- Barry

[R] ? extended rep()

2008-10-20 Thread Ted Harding
Hi Folks, I'm wondering if there's a compact way to achieve the following. The dream is that, by analogy with rep(c(0,1),times=c(3,4)) # [1] 0 0 0 1 1 1 1 one could write rep(c(0,1),times=c(3,4,5,6)) which would produce # [1] 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 in effect recycling x

Re: [R] ? extended rep()

2008-10-20 Thread jim holtman
will this do what you want: f.rep - function(x, times){ + # make sure the 'x' is long enough + x - head(rep(x, length(times)), length(times)) + rep(x, times) + } f.rep(c(0,1), c(3,4,5,6,7)) [1] 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 On Mon, Oct 20, 2008 at 4:57 PM,

Re: [R] ? extended rep()

2008-10-20 Thread Gabor Grothendieck
Try this: with(data.frame(x = 0:1, times = 3:6), rep(x, times)) or even shorter: do.call(rep, data.frame(x = 0:1, times = 3:6)) On Mon, Oct 20, 2008 at 4:57 PM, Ted Harding [EMAIL PROTECTED] wrote: Hi Folks, I'm wondering if there's a compact way to achieve the following. The dream is

Re: [R] ? extended rep()

2008-10-20 Thread Stefan Evert
On 20 Oct 2008, at 22:57, (Ted Harding) wrote: I'm wondering if there's a compact way to achieve the following. The dream is that one could write rep(c(0,1),times=c(3,4,5,6)) which would produce # [1] 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 in effect recycling x through 'times'. rep2 -

Re: [R] ? extended rep()

2008-10-20 Thread Gabor Grothendieck
Here is one other solution: x - 0:1 times - 3:6 rep(x + 0*times, times) This solution also works if the length of times is not a whole number of lengths of x but in that case it does give a warning which seems reasonable since that is the way recycling in R works elsewhere too. On Mon, Oct 20,

Re: [R] Staging area for data before read into R

2008-10-20 Thread Carl Witthoft
Why not just write your data to a CSV (comma-spaced-variable) or a tab-spaced variable text file? You didn't say what software and/or hardware was generating your data, but most gizmos these days let you dump data to CSV. No need for Excel at all. I forget :-( how many rows/columns

Re: [R] ? extended rep()

2008-10-20 Thread Ted Harding
On 20-Oct-08 21:19:21, Stefan Evert wrote: On 20 Oct 2008, at 22:57, (Ted Harding) wrote: I'm wondering if there's a compact way to achieve the following. The dream is that one could write rep(c(0,1),times=c(3,4,5,6)) which would produce # [1] 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 in

Re: [R] ? extended rep()

2008-10-20 Thread Ted Harding
On 20-Oct-08 21:17:22, Gabor Grothendieck wrote: Try this: with(data.frame(x = 0:1, times = 3:6), rep(x, times)) or even shorter: do.call(rep, data.frame(x = 0:1, times = 3:6)) That is sneaky! data.frame(x = 0:1, times = 3:6) # x times # 1 0 3 # 2 1 4 # 3 0 5 # 4 1 6

Re: [R] Categorical Response Query

2008-10-20 Thread andyer weng
Hi all, I have a queston about Categorical response. i have a data frame containing age, sex, class, success(1=success, 0=non sucess). age, sex,class are the explantory variables, and sucess is the response variable. and i can get n (the nunber of times each age occurs) and r (the number of

[R] aggregating along bins and bin-quantiles

2008-10-20 Thread Ivan Alves
Dear all, I would like to aggregate a data frame (consisting of 2 columns - one for the bins, say factors, and one for the values) along bins and quantiles within the bins. I have tried aggregate(data.frame$values, list(bin = data.frame $bin,Quantile=cut2(data.frame$bin,g=10)),sum) but

Re: [R] R Newbie Question

2008-10-20 Thread Gabor Grothendieck
tIs a bit neater to create list objects for each of star1 and star2 and then, since the various functions are not used outside of gravitation stick them right in gravitation. Also we can use distance for len as well by giving it a default second arg of 0 and sqr does not seem to do much so we can

Re: [R] aggregating along bins and bin-quantiles

2008-10-20 Thread Ivan Alves
Apologies, just a typo in the first instruction (when translating the names), the question is still valid On 21 Oct 2008, at 00:38, Ivan Alves wrote: Dear all, I would like to aggregate a data frame (consisting of 2 columns - one for the bins, say factors, and one for the values) along bins

[R] Mclust problem with mclust1Dplot: Error in to - from : non-numeric argument to binary operator

2008-10-20 Thread Emmanuel Levy
Dear list members, I am using Mclust in order to deconvolute a distribution that I believe is a sum of two gaussians. First I can make a model: my.data.model = Mclust(my.data, modelNames=c(E), warn=T, G=1:3) But then, when I try to plot the result, I get the following error:

Re: [R] Staging area for data before read into R

2008-10-20 Thread Jim Porzak
Hi Stephen, You don't say what staging is - do you mean for data entry or loading a data file for review, or ... ? In general, I keep away from Excel for data transfer purposes. It tends to make intelligent decisions on data types leading to strange bizarre results (unless you explicitly type

Re: [R] Staging area for data before read into R

2008-10-20 Thread Gabor Grothendieck
There is a list of free spreadsheets with their row and column limits at this link: http://en.wikipedia.org/wiki/OpenOffice.org_Calc On Mon, Oct 20, 2008 at 3:13 PM, stephen sefick [EMAIL PROTECTED] wrote: sorry excel 2003 with no immediate update in the future. On Mon, Oct 20, 2008 at 3:12

Re: [R] Staging area for data before read into R

2008-10-20 Thread stephen sefick
Well, I am going to type in ever value because the data sheets are of counts of insects that I identified, so I should be okay with accuracy... I really just need something that allows for more than 256 columns as I have encounter over 256 species of insects in even small streams. I think calc

Re: [R] Variable shortlisting for the logistic regression

2008-10-20 Thread Greg Snow
I nominate the below 2 paragraphs (or a possible shortening of them) as a new fortune. While not as entertaining as many of the current fortunes, the wisdom gained and sentiment expressed deserves preservation and easy reference for future posters who think that Frank is only trying to be

[R] New mailing list r-sig-hpc

2008-10-20 Thread Dirk Eddelbuettel
As interest in topics that are often grouped under the catch-all umbrella of 'high performance computing with R' has grown over the last few months, it has been suggested to create a dedicated mailing list. Now, thanks to Martin Maechler who tirelessly looks after all R mailing matters, such a

Re: [R] Staging area for data before read into R

2008-10-20 Thread Christopher W. Ryan
How about simply a text editor, typing in your data, separated by commas or tabs or spaces? One row for each case/subject/observation? R can read that in easily. A good, open-source, free data entry program is EpiData. www.epidata.dk. It is simple to use but probably more than you need for

Re: [R] Staging area for data before read into R

2008-10-20 Thread Seeliger . Curt
Well, I am going to type in ever value because the data sheets are of counts of insects that I identified, so I should be okay with accuracy... I really just need something that allows for more than 256 columns as I have encounter over 256 species of insects in even small streams. ... Oh,

Re: [R] converting a row of a data.frame to a vector

2008-10-20 Thread z3025589
Try: as.vect = function(x) { t1 = as.matrix(x) t2 = aperm(t1) t3 = as.vector(t2) return(t3) } This function converts entire dataframe into a vector. Alexander Pui PhD Candidate in Hydroclimatology, University of New South Wales Email: [EMAIL PROTECTED]

[R] how to plot the histogram and the curve in the same graph

2008-10-20 Thread leo_wa
i want to plot the histogram and the curve in the same graph.if i have a set of data ,i plot the histogram and also want to see what distribution it was.So i want to plot the curve to know what distribution it like. -- View this message in context:

[R] Simulation of data

2008-10-20 Thread Marcioestat
Hi listers, I am working on a program of statistical analysis of simulated data and I've been searching the error at the program, but I didn't find it! It is something about the WHILE procedure, the error says: Error in while (ecart = d) { : missing value where TRUE/FALSE needed Thanks in

Re: [R] Using an image background with graphics

2008-10-20 Thread Waichler, Scott R
Greg, The rimage package has functions for reading in and plotting jpeg files that you could use for displaying the photograph. If you then can find 2 points in the image (not on the same horizontal or vertical line) for which you know the coordinates in the coordinate system that you

Re: [R] Using an image background with graphics

2008-10-20 Thread Prof Brian Ripley
Most likely this is a bug in your pdf viewer: try turning off anti-aliasing there (or use a better viewer, if that is not an option). It is a symptom of anti-aliasing of the rectangles used to plot image pixels. You haven't told us which 'a pdf device' and there are several for R, depending