Re: [R] Trouble installing gsl wrapper

2010-10-30 Thread Prof Brian Ripley
On Sat, 30 Oct 2010, Gang Chen wrote: Hi, I'm trying to install the gsl wrapper source code (http://cran.r-project.org/src/contrib/gsl_1.9-8.tar.gz) on a Linux system (OpenSuse 11.1), but encountering the following problem. I've already installed 'gsl' version 1.14 (ftp://ftp.gnu.org/gnu/gsl/gs

Re: [R] Trouble installing gsl wrapper

2010-10-30 Thread Gang Chen
You nailed it, Prof. Ripley! Thanks a lot... Gang On Sat, Oct 30, 2010 at 2:58 PM, Prof Brian Ripley wrote: > On Sat, 30 Oct 2010, Gang Chen wrote: > >> Hi, >> >> I'm trying to install the gsl wrapper source code >> (http://cran.r-project.org/src/contrib/gsl_1.9-8.tar.gz) on a Linux >> system (O

[R] how to find a function for plotting polygon surfaces: polgon3d(xc, yc, obs)

2010-10-30 Thread Wolfgang Polasek
I have set of n coordinates xc, yc (but not a grid!) and n observations obs at these points. Where to find a simple plot function (3D perspective) that plots a polygon (alternative: just segmented points over a map, as eg in library maps). rgl.surface(xc,yc,obs) is not working. Thanks W.Polasek

[R] one function with 2 returnh points

2010-10-30 Thread Alaios
Hello everyone. I have written quite a big function that at the end correctly returns the values I want. I found a rare exception that I want to cover also. The easier for me would be to write something like that function(){ if (rare exception happened) return that value # The

Re: [R] one function with 2 returnh points

2010-10-30 Thread Liviu Andronic
On Sat, Oct 30, 2010 at 11:09 AM, Alaios wrote: > Hello everyone. > I have written quite a big function that at the end correctly returns the > values > I want. I found a rare exception that I want to cover also. The easier for me > would be to write something like that > > > function(){ > >  if

[R] transforming a dataset for association analysis

2010-10-30 Thread Ajay Ohri
Hi I would like to transform a data frame like SubjectItem Score Subject 1 Item 1 1 Subject 1 Item 2 0 Subject 1 Item 3 1 Subject 2 Item 1 1 Subject 2 Item 2 1 Subject 2 Item 3 0 *to * Subject Item1 Item2 Item3 .Item N Subject1 1 0 1 Subject2 1

Re: [R] Differenciate numbers from reference for rows

2010-10-30 Thread David Winsemius
On Oct 29, 2010, at 11:16 PM, Dennis Murphy wrote: Hi: x <- matrix(20:35, ncol = 1) u <- c(1, 4, 5, 6, 11) # 'x values' m <- c(1, 3, 1, 1, 0.5) # Function to compute the inner product of the multipliers with the extracted # elements of x determined by u f <- function(mat, inputs, mults)

Re: [R] Trouble installing gsl wrapper

2010-10-30 Thread robin hankin
An interesting exchange. The package has some installation tips in Misc.Rd, but perhaps these are not sufficiently prominent. I think it'd be a good idea to include a READ.ME file in inst/doc with installation information, and include a pointer to this in the DESCRIPTION file; I'll adapt parts of

Re: [R] Clustering

2010-10-30 Thread dpender
David Winsemius wrote: > > > On Oct 29, 2010, at 12:08 PM, David Winsemius wrote: > >> >> On Oct 29, 2010, at 11:37 AM, dpender wrote: >> >>> Apologies for being vague, >>> >>> The structure of the output is as follows: >> >> Still no code? >> > > I am using the Clusters function from the evd

Re: [R] transforming a dataset for association analysis

2010-10-30 Thread Santosh Srinivas
A more usable problem input would definitely help ... use dput to send a reproducible sample to the group Think the below should solve your problem > read.csv("Book1.csv") Subject Item Score 1 Subject 1 Item 1 1 2 Subject 1 Item 2 0 3 Subject 1 Item 3 1 4 Subject 2 Item 1 1

Re: [R] transforming a dataset for association analysis

2010-10-30 Thread Rainer Hurling
On 30.10.2010 13:50 (UTC+1), Santosh Srinivas wrote: A more usable problem input would definitely help ... use dput to send a reproducible sample to the group Think the below should solve your problem read.csv("Book1.csv") Subject Item Score 1 Subject 1 Item 1 1 2 Subject 1 Item 2

Re: [R] wait for graph to finish plotting

2010-10-30 Thread news
David Winsemius writes: Aha.. thankyou, I was not aware of that. > Now you have changed plotting functions from plot and barplot over to > barchart (a Lattice function) and were not aware of FAQ 7.22: > > http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_0

Re: [R] Clustering

2010-10-30 Thread David Winsemius
On Oct 30, 2010, at 7:49 AM, dpender wrote: David Winsemius wrote: On Oct 29, 2010, at 12:08 PM, David Winsemius wrote: On Oct 29, 2010, at 11:37 AM, dpender wrote: Apologies for being vague, The structure of the output is as follows: Still no code? I am using the Clusters functio

Re: [R] Differenciate numbers from reference for rows

2010-10-30 Thread Gabor Grothendieck
On Fri, Oct 29, 2010 at 6:54 PM, M.Ribeiro wrote: > > So, I am having a tricky reference file to extract information from. > > The format of the file is > > x   1 + 4 * 3 + 5 + 6 + 11 * 0.5 > > So, the elements that are not being multiplied (1, 5 and 6) and the elements > before the multiplication

[R] overloading "[" and "[<-" using S3 classes

2010-10-30 Thread Mark Heckmann
How can I overload the "[" and "[<-" operators using S3 classes? Something like '['.{class} did not work or at least I do not know how to define it properly. For S4 it is straightforward: setMethod("[", signature(x = "myClass", i = "numeric"), function (x, i, j, ..., drop){

Re: [R] one function with 2 returnh points

2010-10-30 Thread Alaios
Thanks a lot :) From: Liviu Andronic Cc: Rhelp Sent: Sat, October 30, 2010 11:31:35 AM Subject: Re: [R] one function with 2 returnh points > Hello everyone. > I have written quite a big function that at the end correctly returns the >values > I want. I fou

Re: [R] overloading "[" and "[<-" using S3 classes

2010-10-30 Thread Gabor Grothendieck
On Sat, Oct 30, 2010 at 9:03 AM, Mark Heckmann wrote: > How can I overload the "[" and "[<-" operators using S3 classes? > Something like '['.{class} did not work or at least I do not know how to > define it properly. > > > For S4 it is straightforward: > > setMethod("[", signature(x = "myClass",

Re: [R] vertical list sum

2010-10-30 Thread Henrique Dallazuanna
Another way: x <- list(c(9, 5, 7, 2, 14, 4, 4, 3), c(3, 6, 25, 2, 14, 3, 3, 4), c(28, 4, 14, 3, 14, 2, 4, 5), 28) apply(array(unlist(lapply(x, '[', 1:max(sapply(x, length, dim = c(1, 8, 4)), 1:2, mean, na.rm = TRUE) or rowMeans(as.data.frame(lapply(x, '[', 1:max(sapply(x, length, na.r

Re: [R] Differenciate numbers from reference for rows

2010-10-30 Thread David Winsemius
On Oct 30, 2010, at 8:42 AM, Gabor Grothendieck wrote: On Fri, Oct 29, 2010 at 6:54 PM, M.Ribeiro wrote: So, I am having a tricky reference file to extract information from. The format of the file is x 1 + 4 * 3 + 5 + 6 + 11 * 0.5 So, the elements that are not being multiplied (1, 5 an

[R] solving equation consisting of factorials

2010-10-30 Thread Shant Ch
Hi, I was trying to solve for m such that, choose(n-1,k-1)+choose(n-2,k-1)+...+choose(n-m+1,k-1) - ck=0 ck is calculated by the way given in the code. Now I solved for m using uniroot but the error messages appeared. n<-30 k=3 alpha<-0.05 nk<-choose(n,k); ck<-(nk/2)+k*nk*qnorm(1-alpha)/(1

Re: [R] Differenciate numbers from reference for rows

2010-10-30 Thread Gabor Grothendieck
On Sat, Oct 30, 2010 at 9:43 AM, David Winsemius wrote: > > On Oct 30, 2010, at 8:42 AM, Gabor Grothendieck wrote: > >> On Fri, Oct 29, 2010 at 6:54 PM, M.Ribeiro >> wrote: >>> >>> So, I am having a tricky reference file to extract information from. >>> >>> The format of the file is >>> >>> x   1

Re: [R] date calculation

2010-10-30 Thread Ben Bolker
On 10-10-30 02:02 AM, Shi, Tao wrote: > Hi Ben, > > That must be the case! In fact if I do: > >> difftime(strptime("24NOV2004", format="%d%b%Y"), >> strptime("13MAY2004",format="%d%b%Y"), units="days", tz="GMT") > Time difference of 195 days > > > which supports your claim. > > Can someone f

Re: [R] date calculation

2010-10-30 Thread Marc Schwartz
On Oct 30, 2010, at 9:22 AM, Ben Bolker wrote: > On 10-10-30 02:02 AM, Shi, Tao wrote: >> Hi Ben, >> >> That must be the case! In fact if I do: >> >>> difftime(strptime("24NOV2004", format="%d%b%Y"), >>> strptime("13MAY2004",format="%d%b%Y"), units="days", tz="GMT") >> Time difference of 195

Re: [R] wilcox.test; data type conversion?

2010-10-30 Thread Peter Dalgaard
On 10/29/2010 05:41 AM, Dennis Murphy wrote: > Hi: > > Make grade an ordered factor: > grade <- factor(grade, levels = c('G', 'VG', 'MVG')) > as.numeric(as.character(grade)) will convert to numeric scores 1, 2 and 3, > respectively, corresponding to the numerical codes of the ordered levels. Not

[R] Any similar solution for C# (Integrating R with C++: Rcpp, RInside, and RProtobuf)

2010-10-30 Thread Haoda Fu
Friends - I am pretty excited for the following talk and I was wondering if there is a similar solution for C#. I googled but didn't find a good solution. Previously, I let C# to send R code to Rscript.exe. But it is not an integrated solution. Integrating R with C++: Rcpp, RInside, and RProtobu

Re: [R] wilcox.test; data type conversion?

2010-10-30 Thread Peter Dalgaard
On 10/29/2010 06:24 AM, Steven McKinney wrote: >> > wilcox.test(as.integer(grade) ~ sex, data = gradesbysex) > Wilcoxon rank sum test with continuity correction > > data: as.integer(grade) by sex > W = 4.5, p-value = 0.2695 > alternative hypothesis: true location shift is not equal to 0 >

[R] compare quality of clustering methods?

2010-10-30 Thread Khanh Nguyen
Hi, Suppose I want to compare the results of two clustering methods, what is the best way to do it? Thanks Regards, -k __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-proj

[R] ForestPlot or similar

2010-10-30 Thread Mestat
Hi listers, I am trying to plot some confidence intervals. The function FORESTPLOT, would work, but I need something more simple. I dont need to define the text labels. Is there another function that I can plot some confidence intervals. Thanks in advance, Marcio -- View this message in context:

Re: [R] plot pdf

2010-10-30 Thread mmstat
Subject: plot Your recent reply has got me underway.  However the savePlot command is not working.   I am following refman example. Any thoughts?  I am on a new windows 7 os.  I am not sure how to open a new device (output graphic window).  I wonder if that could be the problem? R Code

Re: [R] ForestPlot or similar

2010-10-30 Thread Mestat
Here is one example: I have three vectors (mean,lower interval, upper interval) mean<-c(2,4,6,8) l<-c(1,2,3,4) u<-c(4,8,12,16) How would I plot that if I want to use the FORESTPLOT function. I dont need to use the TABLETEXT option. I am working in something like this: tabletext<-c(NA,NA,NA,NA,NA)

Re: [R] plot pdf

2010-10-30 Thread Uwe Ligges
On 30.10.2010 17:23, mms...@comcast.net wrote: Subject: plot Your recent reply has got me underway. However the savePlot command is not working. I am following refman example. Any thoughts? I am on a new windows 7 os. I am not sure how to open a new device (output graphic window). I

Re: [R] solving equation consisting of factorials

2010-10-30 Thread David Winsemius
On Oct 30, 2010, at 9:55 AM, Shant Ch wrote: Hi, I was trying to solve for m such that, choose(n-1,k-1)+choose(n-2,k-1)+...+choose(n-m+1,k-1) - ck=0 ck is calculated by the way given in the code. Now I solved for m using uniroot but the error messages appeared. n<-30 k=3 alpha<-0.05 n

[R] Using names function

2010-10-30 Thread Sudhakar Kumar
Just starting on my journey to learn R and the book I am using is "Using R for Introductory Statistics" One of the problems (page 15, 1.10) goes as follows: The monthly sales fig for 2002 were (2700, 2600, 3050, . . ). Using diff() find the month with greatest increase from prev month. I crea

Re: [R] Using names function

2010-10-30 Thread Jorge Ivan Velez
Hi Sudhakar, Take a look at ?which.max msales <- c(2700, 2600, 3050) names(msales) <- c("Jan", "Feb", "Mar") names(which.max(diff(msales))) # [1] "Mar" HTH, Jorge On Sat, Oct 30, 2010 at 12:27 PM, Sudhakar Kumar <> wrote: > > Just starting on my journey to learn R and the book I am using is "

[R] For loop

2010-10-30 Thread 20c
Hi all, how can i make the following loop faster? vv[20001,22]=v[20001,22] for(k in 21:1) { for(j in 20001:2) { vv[j-1,k+1]=min(xx[j-1]*v[j-1,k+1],vv[j,k+1]) v[j,k]=h[1,k]+vv[j-1,k+1] } vv[20001,k]=v[20001,k] } Thanks Lorenzo -- Caselle da 1GB, trasmetti allegati fino a 3GB

Re: [R] Using names function

2010-10-30 Thread Sudhakar Kumar
Thanks Jorge. That is very helpful. Hadnt seen 'which' yet. So it is a matter of combining functions if I wanted both the value and the month? From: jorgeivanve...@gmail.com Date: Sat, 30 Oct 2010 12:33:12 -0400 Subject: Re: [R] Using names function To: ksudha...@live.com CC: r-help@r-project.o

Re: [R] Using names function

2010-10-30 Thread David Winsemius
On Oct 30, 2010, at 12:27 PM, Sudhakar Kumar wrote: Just starting on my journey to learn R and the book I am using is "Using R for Introductory Statistics" One of the problems (page 15, 1.10) goes as follows: The monthly sales fig for 2002 were (2700, 2600, 3050, . . ). Using diff() find

Re: [R] Using names function

2010-10-30 Thread Jorge Ivan Velez
Hi Sudhakar, Use diff(msales)[which.max(diff(msales))] HTH, Jorge On Sat, Oct 30, 2010 at 12:38 PM, Sudhakar Kumar <> wrote: > > Thanks Jorge. That is very helpful. Hadnt seen 'which' yet. > > So it is a matter of combining functions if I wanted both the value and the > month? > > From: > Da

[R] summary.lm as a post-hoc test?

2010-10-30 Thread Alex F. Bokov
Let's assume that according to Anova(lm(y~a*b, data=d)) the a:b interaction is significant, and I would like to know if there are specific combinations of a and b levels that differ from the control group. Are there any caveats against simply looking at the p-values in the output generated by s

[R] Confidence interval for response variable in mixed effects models

2010-10-30 Thread Brian Willis
HI, I am using lmer() for a simple mixed effects model. The model is of the form logit(y)~ x + (1|z), where x is an indicator variable and z a multi-level factor. I would like an estimate of the response variable (either y or logit y) with an associated confidence interval for a given value of x.

[R] 'tcltk' does not have a name space

2010-10-30 Thread chen chao
Hi, All I got trouble on installing the qvalue package. Error message: package 'tcltk' does not have a name space [cch...@ibibmem Yale_CB]$ R CMD INSTALL qvalue.tar.gz * installing to library '/cchome/cchen1/R/x86_64-unknown-linux-gnu-library/2.10' * installing *source* package 'qvalue' ... ** R

Re: [R] wilcox.test; data type conversion?

2010-10-30 Thread Par Leijonhufvud
Peter Dalgaard [2010.10.30] wrote: > I wouldn't bother with that. The p-value is based on the correct > covariance matrix of the rank sums, tie-breaking just adds noise to the > analysis. Good to know. > If you really want an exact p-value, package exactRankTests is In this case I suspect that

[R] for loop

2010-10-30 Thread Matevž Pavlič
Hi, I know this is probalby a very trivial thing to do for most of the R users, but since I just strated using it I have some problems I have a data.frame with a field called "razred". This field has values from 1 up to 15. Is it possible to create a for loop that would create a ne

Re: [R] Confidence interval for response variable in mixed effects models

2010-10-30 Thread Ben Bolker
Brian Willis manchester.ac.uk> writes: > I am using lmer() for a simple mixed effects model. The model is of the form > logit(y)~ x + (1|z), where x is an indicator variable and z a multi-level > factor. > > I would like an estimate of the response variable (either y or logit y) with > an associ

Re: [R] for loop

2010-10-30 Thread David Winsemius
On Oct 30, 2010, at 2:07 PM, Matevž Pavlič wrote: Hi, I know this is probalby a very trivial thing to do for most of the R users, but since I just strated using it I have some problems I have a data.frame with a field called "razred". This field has values from 1 up to 15. Is it po

Re: [R] for loop

2010-10-30 Thread Jorge Ivan Velez
Hi Matevž, Perhaps split() is what you are looking for: # some data x <- rep(rpois(5, 10), 4) y <- rnorm(20) d <- data.frame(x, y) d split(d, x) See ?split and ?strsplit for more information. HTH, Jorge On Sat, Oct 30, 2010 at 2:07 PM, Matevž Pavlič <> wrote: > Hi, > > > > I know thi

Re: [R] Confidence interval for response variable in mixed effects models

2010-10-30 Thread David Winsemius
On Oct 30, 2010, at 11:33 AM, Brian Willis wrote: HI, I am using lmer() for a simple mixed effects model. The model is of the form logit(y)~ x + (1|z), where x is an indicator variable and z a multi- level factor. I would like an estimate of the response variable (either y or logit y)

[R] summary.lm for post-hoc tests

2010-10-30 Thread Alex Bokov
Let's say I've run Anova(lm(y~a*b)) and found the a:b interaction to be significant. Now I'm interested in which specific level combinations of a and b significantly differ from the control group. Can I use the t-tests from summary(lm(y~a*b)) to answer that question? I saw no mention of multip

[R] R & VBA

2010-10-30 Thread julien cuisinier
Hi List, Is there any way to pass on directly VBA variable content into a R variable? on windows XP & using R 2.12.0 I have installed RExcel addin (with associated D(COM)) >> It function fine when trying to pass Excel Range to R but I failed (sorry if >> it is only my own limitation, search

Re: [R] for loop

2010-10-30 Thread Matevž Pavlič
Just one more thing... I get a list with 15 data.frames : List of 15 $ 1:'data.frame': 7 obs. of 9 variables: ..$ vrtina : Factor w/ 6 levels "T1A-1","T1A-2",..: 1 1 2 2 5 5 5 ..$ globina.meritve: num [1:7] 7.6 8.5 10.4 17.4 12.5 15.5 16.5 ..$ E0 : num [1:7] 4109 2

Re: [R] for loop

2010-10-30 Thread David Winsemius
On Oct 30, 2010, at 3:00 PM, Matevž Pavlič wrote: Just one more thing... I get a list with 15 data.frames : List of 15 $ 1:'data.frame': 7 obs. of 9 variables: ..$ vrtina : Factor w/ 6 levels "T1A-1","T1A-2",..: 1 1 2 2 5 5 5 ..$ globina.meritve: num [1:7] 7.6 8.5 10.4 17.4

Re: [R] R & VBA

2010-10-30 Thread RICHARD M. HEIBERGER
Look at the macro RInterface.PutArrayFromVBA documented in the RExcel help file. Please send followup questions on RExcel and statconnDCOM to the mailing list at "statconnDCOM, rcom, and RExcel server related issues" < rco...@mailman.csd.univie.ac.at> Rich On Sat, Oct 30, 2010 at 1:44 PM, julien

Re: [R] date calculation

2010-10-30 Thread Shi, Tao
Hi Ben and Josh, No, I don't think that there is a bug. It's just due to my lack of knowledge on Date class, I was simply amazed that it has the daylight saving time built in at first. But on the second thought, it really should. Thank you all for the explanations! ...Tao From: Ben Bolke

Re: [R] date calculation

2010-10-30 Thread Shi, Tao
I think this demonstrate on of the differences between Class 'Date' and 'POSIXlt'. Thanks, Marc! ...Tao From: Marc Schwartz To: Ben Bolker Cc: "Shi, Tao" ; "r-h...@stat.math.ethz.ch" Sent: Saturday, October 30, 2010 7:48:05 AM Subject: Re: [R] date calculation On Oct 30, 2010, at 9:22

Re: [R] summary.lm for post-hoc tests

2010-10-30 Thread Dimitri Liakhovitski
Check this out: http://www.rforge.net/doc/packages/NCStats/compSlopes.html However, it looks like one need to install NCStats (http://www.rforge.net/NCStats/files/). Or is there a more "mainstream" method of running multiples comparisons among slopes? Dimitri On Sat, Oct 30, 2010 at 1:20 PM, A

[R] two group cox model

2010-10-30 Thread cheba meier
Dear all, I am doing library(survival) fit <- coxph(Surv(futime,fustat) ~ rx, ovarian) plot(survfit(fit,newdata=ovarian),col=c(1,2)) legend("bottomleft", legend=c("rx = 0", "rx = 1"), lty=c(1,2),col=c(1,2)) Is this correct to compare these two groups? Is the 0.31 the p-value that the me

Re: [R] doubt in climate variability analysis in R! - code included!

2010-10-30 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of govin...@msu.edu > Sent: Friday, October 29, 2010 11:56 AM > To: r-help@r-project.org > Subject: Re: [R] doubt in climate variability analysis in R! - code > included! > > > >

Re: [R] summary.lm as a post-hoc test?

2010-10-30 Thread Alex Bokov
On 10/30/2010 03:34 PM, Dimitri Liakhovitski wrote: You are asking a statistics question, not an R question. R-list people never react to such posts. Or they give you a nasty reply of the type: "Do you homework first, and then ask questions here." Good point. I thought it was an R question

Re: [R] doubt in climate variability analysis in R! - code included!

2010-10-30 Thread govindas
--- Begin Message --- I am sorry, i think the link was broken..! here is the correct one!!![1] http://www.4shared.com/file/4zV0g3JR/RF_80-85.html -- Regards, Mahalakshmi Graduate Student #20, Department of Geography Michigan State University East Lansing, MI 48824

Re: [R] ForestPlot or similar

2010-10-30 Thread Matt Shotwell
Here is a small function for forest plots in R, with an example: http://biostatmatt.com/wiki/r-credplot -Matt On Sat, 2010-10-30 at 11:40 -0400, Mestat wrote: > Here is one example: > I have three vectors (mean,lower interval, upper interval) > mean<-c(2,4,6,8) > l<-c(1,2,3,4) > u<-c(4,8,12,16)

Re: [R] summary.lm as a post-hoc test?

2010-10-30 Thread Dimitri Liakhovitski
Then look at that package I referred in the other e-mail. It does exactly what you need - I am just not sure if it's still available. The author's e-mail is there, though - you can ask. Good luck. Dimitri On Sat, Oct 30, 2010 at 5:04 PM, Alex Bokov wrote: > > > On 10/30/2010 03:34 PM, Dimitri Lia

Re: [R] two group cox model

2010-10-30 Thread David Winsemius
On Oct 30, 2010, at 4:36 PM, cheba meier wrote: Dear all, I am doing library(survival) fit <- coxph(Surv(futime,fustat) ~ rx, ovarian) plot(survfit(fit,newdata=ovarian),col=c(1,2)) legend("bottomleft", legend=c("rx = 0", "rx = 1"), lty=c(1,2),col=c(1,2)) Is this correct to compare th

Re: [R] compare quality of clustering methods?

2010-10-30 Thread Tal Galili
It depends on how your clustered objects are stored. As written here: http://www.statmethods.net/advstats/cluster.html The function *cluster.stats() *in the *fpc * package provides a mechanism for comparing the similarity of two cluster solut

Re: [R] For loop

2010-10-30 Thread Tal Galili
I can't see how to vectorized your code, maybe it's possible. That leaves you with either using parallel processing (for example using the foreach package) Or, If you know C, you could put that calculation into a C code inside the R code using Rcpp. There was a recent video on the topic on a goo

Re: [R] For loop

2010-10-30 Thread Joshua Wiley
Hi, In general, the way to speed up for loops in R is to avoid them. It looks like some of the operations could be vectorized (e.g., h[1,k] + vv[j-1,k+1] looks like you could just add entire columns at once). If you provide sample data for all the variables in your loop, it will be possible to g

[R] return value for grep

2010-10-30 Thread Ulrich
Hi, is it possible to easily change the return value for the grep function for cases where there is no match, for example the value 0 or "No" instead of integer (0) )? Thanks, Uli __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/

Re: [R] return value for grep

2010-10-30 Thread David Winsemius
On Oct 30, 2010, at 10:51 PM, Ulrich wrote: Hi, is it possible to easily change the return value for the grep function for cases where there is no match, for example the value 0 or "No" instead of integer (0) )? Seems like is should be pretty easy. Test for length(grep(...)) == 0 or

Re: [R] for loop

2010-10-30 Thread Dennis Murphy
Hi: If your objective is to make 15 plots, one for each level of razred, then you don't need to make 15 individual data frames first. The lattice and ggplot2 packages allow conditioning plots. You haven't mentioned what types of plots you're interested in getting, but if it's something simple like

Re: [R] return value for grep

2010-10-30 Thread Gabor Grothendieck
On Sat, Oct 30, 2010 at 10:51 PM, Ulrich wrote: > Hi, > > is it possible to easily change the return value for the grep function for > cases where there is no match, for example the value 0 or "No" instead of > integer (0) )? > Try this: > Find(length, list(grep("X", letters), 0)) [1] 0 > Find(l

Re: [R] make many barplot into one plot

2010-10-30 Thread Jim Lemon
On 10/29/2010 11:33 PM, "Sibylle Stöckli" wrote: Dear R users I would like to group my barplot graph (see example on the R help link). The proposed R code, adding individual bars to the plot, looks really overwhelming. My specific dataset just consists of five groups and three different level

Re: [R] return value for grep

2010-10-30 Thread David Winsemius
On Oct 30, 2010, at 11:13 PM, David Winsemius wrote: On Oct 30, 2010, at 10:51 PM, Ulrich wrote: Hi, is it possible to easily change the return value for the grep function for cases where there is no match, for example the value 0 or "No" instead of integer (0) )? Seems like is shou

[R] Fwd: ForestPlot or similar

2010-10-30 Thread Abhijit Dasgupta
> From: Abhijit Dasgupta > Date: October 31, 2010 1:30:02 AM EDT > To: Matt Shotwell > Subject: Re: [R] ForestPlot or similar > > I just did something very similar using ggplot's pointrange geom. In the > following, I'm plotting hazard ratios, for which the nominal value is 1 and > not 0. x h

Re: [R] Constrained Regression

2010-10-30 Thread Jim Silverton
Hello everyone, I have 3 variables Y, X1 and X2. Each variables lies between 0 and 1. I want to do a constrained regression such that a>0 and (1-a) >0 for the model: Y = a*X1 + (1-a)*X2 I tried the help on the constrained regression in R but I concede that it was not helpful. Any help is greatl

[R] make many barplot into one plot

2010-10-30 Thread Sibylle Stöckli
Dear R users I would like to group my barplot graph (see example on the R help link). The proposed R code, adding individual bars to the plot, looks really overwhelming. My specific dataset just consists of five groups and three different levels within each groups (the individual bars). T