Re: [R] Programming Assignment 1: Quiz Air Pollution (Week 2: Programming with R)

2016-05-23 Thread S Ellison
You are probably using the wrong forum for this question and would save time by posting elsewhere rather than waiting for a reply here. The stock answer to this type of request on R-help is 'Please read the Posting Guide (https://www.r-project.org/posting-guide.html) with special attention to "B

Re: [R] Programming R to avoid loops

2015-04-18 Thread Jeff Newmiller
Oh, great. An app [1] that introduces "me too" emails with a click and uses HTML to tell us all about it. Jim, this is probably not a good place to use that function. Read the posting guide about mailing list nettiquette. [1] http://readwrite.com/2013/06/05/new-boxer-ios-email-app-is-all-about-

Re: [R] Programming R to avoid loops

2015-04-18 Thread Jim Mankin
Jim Mankin liked your message with Boxer. On April 18, 2015 at 10:48:17 AM MST, Charles C. Berry wrote:On Sat, 18 Apr 2015, Brant Inman wrote:> I have two large data frames with the following structure:>>> df1> id date test1.result> 1 a 2009-08-28 1> 2 a 2009-09-16 1> 3 b 2008-08-06 0> 4 c 201

Re: [R] Programming R to avoid loops

2015-04-18 Thread Charles C. Berry
On Sat, 18 Apr 2015, Brant Inman wrote: I have two large data frames with the following structure: df1 id date test1.result 1 a 2009-08-28 1 2 a 2009-09-16 1 3 b 2008-08-06 0 4 c 2012-02-02 1 5 c 2010-08-03 1 6 c 2012-08-02 0 df2 id date te

Re: [R] Programming R to avoid loops

2015-04-18 Thread Jim Lemon
Hi Brant, I'm a bit confused about which data frame is the one to match to, but the following, while still including loops, should run much faster than the above as it only matches dates within id matches. df1<-read.table(text="id date test1.result a 2009-08-28 1 a 2009-09-16 1 b 2

Re: [R] Programming Statistical Functions

2011-12-04 Thread David Winsemius
On Dec 4, 2011, at 9:27 AM, gvjones wrote: Hello, Did you find anything helpful for calculating the statistical functions in your list. I would like to also calculate these and have been looking for some code to do so. A search at the site linked by the R function RSiteSearch() produce

Re: [R] Programming Statistical Functions

2011-12-04 Thread gvjones
Hello, Did you find anything helpful for calculating the statistical functions in your list. I would like to also calculate these and have been looking for some code to do so. Thanks -- View this message in context: http://r.789695.n4.nabble.com/Programming-Statistical-Functions-tp2307880p41570

Re: [R] Programming Statistical Functions

2011-12-04 Thread B77S
As Stephen pointed out, this is easy to do. The word file the OP posted has all the necessary formulae. Now you just need to learn how to convert those formulae into R functions Stephen gave you an example of how to create a function for CV. Now run with it. perhaps something like this is w

Re: [R] programming: telling a function where to look for the entered variables

2011-04-01 Thread E Hofstadler
011 14:28 > To: Nick Sabbe > Cc: r-help@r-project.org > Subject: Re: [R] programming: telling a function where to look for the > entered variables > > Thanks Nick and Juan for your replies. > > Nick, thanks for pointing out the warning in subset(). I'm not sure > th

Re: [R] programming: telling a function where to look for the entered variables

2011-04-01 Thread Nick Sabbe
nk: http://biomath.ugent.be wink: A1.056, Coupure Links 653, 9000 Gent ring: 09/264.59.36 -- Do Not Disapprove -Original Message- From: irene.p...@googlemail.com [mailto:irene.p...@googlemail.com] On Behalf Of E Hofstadler Sent: vrijdag 1 april 2011 14:28 To: Nick Sabbe Cc: r-help@r-pro

Re: [R] programming: telling a function where to look for the entered variables

2011-04-01 Thread E Hofstadler
Thanks Nick and Juan for your replies. Nick, thanks for pointing out the warning in subset(). I'm not sure though I understand the example you provided -- because despite using subset() rather than bracket notation, the original function (myfunct) does what is expected of it. The problem I have is

Re: [R] programming: telling a function where to look for the entered variables

2011-04-01 Thread Nick Sabbe
See the warning in ?subset. Passing the column name of lvar is not the same as passing the 'contextual column' (as I coin it in these circumstances). You can solve it by indeed using [] instead. For my own comfort, here is the relevant line from your original function: Data.tmp <- subset(Fulldf, l

Re: [R] programming questions

2010-11-03 Thread Henrik Bengtsson
On Wed, Nov 3, 2010 at 1:04 PM, ivo welch wrote: > thanks, eric---I need a little more clarification.  *yes, I write > functions and then forget them.  so I want them to be self-sufficient. >  I want to write functions that check all their arguments for > validity.)  For example, > >  my.fn <- fun

Re: [R] programming questions

2010-11-03 Thread ivo welch
thanks, eric---I need a little more clarification. *yes, I write functions and then forget them. so I want them to be self-sufficient. I want to write functions that check all their arguments for validity.) For example, my.fn <- function( mylist ) { stop.if.not( is.defined(mylist) ) #

Re: [R] programming questions

2010-11-03 Thread David Winsemius
On Nov 3, 2010, at 3:32 PM, ivo welch wrote: thanks, barry and eric. I didn't do a good job---I did an awful job. is.defined(never.before.seen$anything) ## if a list does not exist, anything in it does not exist either Except the $ function return NULL rather than an error and you alrea

Re: [R] programming questions

2010-11-03 Thread Erik Iverson
alas, should R not come with an is.defined() function? ?exists a variable may never have been created, and this is different from a variable existing but holding a NULL. this can be the case in the global environment or in a data frame. > is.null(never.before.seen) Error: objected 'ne

Re: [R] programming questions

2010-11-03 Thread ivo welch
thanks, barry and eric. I didn't do a good job---I did an awful job. alas, should R not come with an is.defined() function? a variable may never have been created, and this is different from a variable existing but holding a NULL. this can be the case in the global environment or in a data fram

Re: [R] programming questions

2010-11-03 Thread Barry Rowlingson
On Wed, Nov 3, 2010 at 6:17 PM, ivo welch wrote: > yikes.  this is all my fault.  it was the first thing that I ever > defined when I started using R. > >   is.defined <- function(name) exists(as.character(substitute(name))) > > I presume there is something much better... You didn't do a good jo

Re: [R] programming questions

2010-11-03 Thread Jonathan P Daily
the room, the thing itself have purpose? Or do we, what's the word... imbue it." - Jubal Early, Firefly From: ivo welch To: Erik Iverson Cc: r-help Date: 11/03/2010 02:20 PM Subject: Re: [R] programming questions Sent by: r-help-boun...@r-project.org yikes. this is all my

Re: [R] programming questions

2010-11-03 Thread ivo welch
yikes. this is all my fault. it was the first thing that I ever defined when I started using R. is.defined <- function(name) exists(as.character(substitute(name))) I presume there is something much better... /iaw On Wed, Nov 3, 2010 at 2:12 PM, Erik Iverson wrote: > > > ivo welch wrote:

Re: [R] programming questions

2010-11-03 Thread Duncan Murdoch
On 03/11/2010 2:05 PM, ivo welch wrote: quick programming questions. I want to "turn on" more errors. there are two traps I occasionally fall into. * I wonder why R thinks that a variable is always defined in a data frame. > is.defined(d) [1] FALSE > d= data.frame( x=1:5,

Re: [R] programming questions

2010-11-03 Thread Erik Iverson
ivo welch wrote: quick programming questions. I want to "turn on" more errors. there are two traps I occasionally fall into. * I wonder why R thinks that a variable is always defined in a data frame. > is.defined(d) [1] FALSE > d= data.frame( x=1:5, y=1:5 ) > is.defined(

Re: [R] Programming Statistical Functions

2010-07-30 Thread stephen sefick
Maybe and r site search would help? Try and figure out how to calculate these yourself. If you need help send a minimal, reproducible example to this list, and you will probably recieve help. If you need a starting place for programming functions look at an introduction to R. #coefficient of va

Re: [R] programming to calculate variance

2009-09-30 Thread marlene marchena
Thanks a lot, finally It works! I was wondering why my for() did not work. Now I now the difference between i-3 and (i-3) Thanks again for all your help. Marlene. > x y vr 1 2 NA 2 1 NA 3 5 NA 4 8 4.33 5 11 12.33 6 3 9.00 7 1 16.

Re: [R] programming to calculate variance

2009-09-30 Thread Eik Vettorazzi
Hi Marlene, x=data.frame(y,vr=NA) for(i in 4:nrow(x)) x[i,"vr"] =var(y[(i-3):(i-1)]) will do the trick, solving both problems with overwriting subsequent x-values and obeying the precedence of R operators. For the latter, see ?Syntax and compare i<-5 i-3:i-1 (i-3):(i-1) hth. marlene marchena

Re: [R] programming to calculate variance

2009-09-30 Thread Petr PIKAL
marlene marchena napsal dne 30.09.2009 13:28:16: > Hi Petr, > > Thanks for your suggestion. It woks, but now I have other problem the > positions of the values changed. I need the NA values in the three first positions. > > y=c(2,1,5,8,11,3,1,7,50,21,33,7,60) > x=as.zoo(y) > > x > 1 2 3

Re: [R] programming to calculate variance

2009-09-30 Thread marlene marchena
Hi Petr, Thanks for your suggestion. It woks, but now I have other problem the positions of the values changed. I need the NA values in the three first positions. y=c(2,1,5,8,11,3,1,7,50,21,33,7,60) x=as.zoo(y) > x 1 2 3 4 5 6 7 8 9 10 11 12 13 2 1 5 8 11 3 1 7 50 21 33 7 60 va

Re: [R] programming to calculate variance

2009-09-30 Thread Matthias Gondan
I think it should be var(y[i-3:i-1,]) instead of var(x[i-3:i-1,]) otherwise the values of the vector are overwritten Best wishes, Matthias marlene marchena schrieb: Dear R-user Suppose I have the following data y=c(2,1,5,8,11,3,1,7,50,21,33,7,60) x=data.frame(y) for(i in 4:nrow(x)

Re: [R] Programming objects in R

2009-04-02 Thread James W. MacDonald
While not wholly directed towards OO programming, 'R Programming for Bioinformatics' does cover both the S3 and S4 systems (and how to make them play nicely together) at an accessible level. http://www.bioconductor.org/pub/RBioinf/ Best, Jim Krzysztof Sakrejda-Leavitt wrote: Tom Backer Jo

Re: [R] Programming objects in R

2009-04-02 Thread Krzysztof Sakrejda-Leavitt
Tom Backer Johnsen wrote: This is interesting. The fact that there are so few texts on the subject probably means that very few are using OO programming methods in R. That's overstating the problem. I frequently run into OO R packages and many of them are very nicely done. Some good example

Re: [R] Programming objects in R

2009-04-02 Thread Tom Backer Johnsen
Wacek Kusnierczyk wrote: Tom Backer Johnsen wrote: This is interesting. The fact that there are so few texts on the subject probably means that very few are using OO programming methods in R. I will probably look in the Python direction. Pity. I would have preferred R. if you insist on oo

Re: [R] Programming objects in R

2009-04-02 Thread Martin Morgan
Tom Backer Johnsen writes: > This is interesting. The fact that there are so few texts on the > subject probably means that very few are using OO programming methods > in R. Using python is great; your deduction about use of OO in R harder to support. The Bioconductor project (300+ packages, no

Re: [R] Programming objects in R

2009-04-02 Thread Wacek Kusnierczyk
Tom Backer Johnsen wrote: > This is interesting. The fact that there are so few texts on the > subject probably means that very few are using OO programming methods > in R. > > I will probably look in the Python direction. Pity. I would have > preferred R. > if you insist on oo, python might be

Re: [R] Programming objects in R

2009-04-02 Thread Tom Backer Johnsen
This is interesting. The fact that there are so few texts on the subject probably means that very few are using OO programming methods in R. I will probably look in the Python direction. Pity. I would have preferred R. Tom krzysztof.sakre...@gmail.com wrote: I have been using Chambers f

Re: [R] Programming objects in R

2009-03-31 Thread Tom Backer Johnsen
Patrick Burns wrote: I think that 'Software for Data Analysis' by John Chambers should certainly be on the reading list. It seems that that is true. I have a number of R books, but not that one. Thanks for the suggestion. Tom Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http:

Re: [R] Programming objects in R

2009-03-31 Thread Daniel Viar
The third chapter of the book "R Programming for Bioinformatics" by Robert Gentleman is on object-oriented programming in R. Dan Viar Chesapeake, VA On Tue, Mar 31, 2009 at 6:15 AM, Patrick Burns wrote: > I think that 'Software for Data Analysis' > by John Chambers should certainly be > on the

Re: [R] Programming objects in R

2009-03-31 Thread Patrick Burns
I think that 'Software for Data Analysis' by John Chambers should certainly be on the reading list. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of "The R Inferno" and "A Guide for the Unwilling S User") Tom Backer Johnsen wrote: I am planning a proje

Re: [R] programming creating different functions in a loop

2009-03-26 Thread Bert Gunter
ect.org] On Behalf Of Greg Snow Sent: Thursday, March 26, 2009 9:54 AM To: Bert Gunter; 'Florin Maican'; r-help@r-project.org Subject: Re: [R] programming creating different functions in a loop But wrong questions requiring complicated answers are sometimes more fun :-). One difference

Re: [R] programming creating different functions in a loop

2009-03-26 Thread Greg Snow
Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: Bert Gunter [mailto:gunter.ber...@gene.com] > Sent: Thursday, March 26, 2009 10:33 AM > To: Greg Snow; 'Florin Maican'; r-help@r-project.org > Subject: RE: [R] progr

Re: [R] programming creating different functions in a loop

2009-03-26 Thread Bert Gunter
rong question. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Greg Snow Sent: Thursday, March 26, 2009 9:25 AM To: Florin Maican; r-help@r-project.org Subject: Re: [R

Re: [R] programming creating different functions in a loop

2009-03-26 Thread Greg Snow
Anytime that you are tempted to use assign and a loop, you should consider using lapply (or sapply) and a list instead. Consider this alternative: > f <- lapply( 1:3, function(i){ force(i); function(x) x+i} ) > > f[[1]](3) [1] 4 > f[[2]](10) [1] 12 > f[[3]](0) [1] 3 > > sapply( f, function(f)

Re: [R] programming creating different functions in a loop

2009-03-26 Thread Florin Maican
Thanks Luke! It works! My mistake was that I used "local binding" only for "i" and not for the whole function. Best regards, Florin On Thu, 26 Mar 2009 10:57:21 -0500 (CDT) l...@stat.uiowa.edu wrote: > for() does not creae separete bindings for the index each iteration, > so the function bodi

Re: [R] programming creating different functions in a loop

2009-03-26 Thread luke
for() does not creae separete bindings for the index each iteration, so the function bodies see the global binding of i, which in this case will be the final value. One possible solution is to use local(), e.g. for(i in 1:3){ assign(paste("f",i,sep=""), local({ k <- i

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Gabor Grothendieck
Berwin Turlach has pointed out that to be equivalent to the original answer the code should be: plot(a, ylim = range(a) * (1 + 0.06 * c(-1,1))) On Fri, Jan 9, 2009 at 2:22 PM, Gabor Grothendieck wrote: > Or even: > > plot(a, ylim = range(a) + 0.06 * c(-1, 1)) > > > On Fri, Jan 9, 2009 at 2:07 PM

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread stephen sefick
WOW, Gabor, that is fancy. I have gotten better at this R thing, but have far to go. That is a neat solution. thanks Stephen On Fri, Jan 9, 2009 at 2:22 PM, Gabor Grothendieck wrote: > Or even: > > plot(a, ylim = range(a) + 0.06 * c(-1, 1)) > > > On Fri, Jan 9, 2009 at 2:07 PM, Mike Prager w

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Gabor Grothendieck
Or even: plot(a, ylim = range(a) + 0.06 * c(-1, 1)) On Fri, Jan 9, 2009 at 2:07 PM, Mike Prager wrote: > "stephen sefick" wrote: > >> low <- min(a*0.98)-(min(a)*0.04) >> high <- max(a*1.02)+(max(a)*0.04) >> plot(a, ylim=c(low, high)) > > Unless I am misreading your example, this can be done a

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Mike Prager
"stephen sefick" wrote: > low <- min(a*0.98)-(min(a)*0.04) > high <- max(a*1.02)+(max(a)*0.04) > plot(a, ylim=c(low, high)) Unless I am misreading your example, this can be done a little more compactly as: plot(a, ylim = range(a * 0.94, a * 1.06)) -- Mike Prager, NOAA, Beaufort, NC * Opinions

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread stephen sefick
WOW, I am not going to post after midnight. Thank you for your response, and this is what I settled on. `plot.e` <- function(b, w, x, y, z){ a <- window.chron(b, w, x, y, z) low <- min(a*0.98)-(min(a)*0.04) high <- max(a*1.02)+(max(a)*0.04) plot(a, ylim=c(low, high)) lines(a*0.98, col="blue") lin

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Gavin Simpson
On Fri, 2009-01-09 at 00:22 -0500, stephen sefick wrote: > library(StreamMetabolism) > plot.e <- function(b, w, x, y, z){ > a <- window.chron(b, w, x, y, z) > low <- min(b*0.98)+5 > high <- max(b*1.02)+5 > plot(a, ylim=c(low, high)) > lines(a*0.98, col="blue") > lines(a*1.02, col="red") > } > > p

Re: [R] Programming Workshops

2008-09-30 Thread Duncan Murdoch
On 9/30/2008 1:02 PM, Darin Brooks wrote: Good morning Does R (or R users) have a formal training workshop/facility? Or do open-source softwares generally put the onus on the user to learn programming techniques? Are the workshops generally offered for the masses or is there one-on-one tr

Re: [R] Programming Workshops

2008-09-30 Thread John Kane
No but there are various groups/organizations/??? who from time to time offer courses sometimes presented by R experts and R Core developers or package developers . A search of the R-help archives should bring up some of these. RSiteSearch("course") will bring up some examples that may h

Re: [R] programming

2008-09-02 Thread stephen sefick
smultron is my favorite editor on mac. It is more or less a text editor with some text highlighting. I can see the use of Emacs, but my thinking isn't quite there yet. for what its worth Stephen On Tue, Sep 2, 2008 at 8:41 AM, Michael Lawrence <[EMAIL PROTECTED]> wrote: > Am I missing something

Re: [R] programming

2008-09-02 Thread Michael Lawrence
Am I missing something or does that list not include Emacs/ESS? It's also missing TextMate (for the Mac people). There's probably a bunch more stuff for Eclipse than it mentions. Michael On Mon, Sep 1, 2008 at 6:17 PM, Gabor Grothendieck <[EMAIL PROTECTED]>wrote: > Check out: > http://www.scivie

Re: [R] programming

2008-09-01 Thread Gabor Grothendieck
Check out: http://www.sciviews.org/_rgui/projects/Editors.html On Mon, Sep 1, 2008 at 8:52 PM, Yuan Jian <[EMAIL PROTECTED]> wrote: > Hi, > > I am looking for R editor. does anyone know good editor? which tells you > syntax error and it has function to beautify format (insert TAB etc.). > > Yu > >

Re: [R] Programming Concepts and Philosophy

2008-06-23 Thread stephen sefick
This is a lot like music- a good musician knows better when not to play than when to (guitar teacher I had 15+ years ago). stephen On Mon, Jun 23, 2008 at 8:33 AM, jim holtman <[EMAIL PROTECTED]> wrote: > To quote Jon Bentley (Programming Pearls): > > "The fastest, cheapest, most reliable piece

Re: [R] Programming Concepts and Philosophy

2008-06-23 Thread jim holtman
To quote Jon Bentley (Programming Pearls): "The fastest, cheapest, most reliable piece of code is that which isn't there; design as much out of your code as you design in." On Mon, Jun 23, 2008 at 3:57 AM, Philipp Pagel <[EMAIL PROTECTED]> wrote: > On Fri, Jun 20, 2008 at 10:04:46AM -0500, hadley

Re: [R] Programming Concepts and Philosophy

2008-06-23 Thread Philipp Pagel
On Fri, Jun 20, 2008 at 10:04:46AM -0500, hadley wickham wrote: > 2008/6/20 [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > On 20 июн, 11:06, Wacek Kusnierczyk > > <[EMAIL PROTECTED]> wrote: > >> the result may be that the more beautiful the code, the more the > >> performance > >> sucks. > > > > Sad b

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread Esmail Bonakdarian
hadley wickham wrote: 2008/6/20 [EMAIL PROTECTED] <[EMAIL PROTECTED]>: If you do nothing to your code, in 18 months time its performance will have doubled because computers will have become faster. Your code will not get easier to understand by itself. Very nicely put .. and true too! __

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread Ramon Diaz-Uriarte
2008/6/20 hadley wickham <[EMAIL PROTECTED]>: > 2008/6/20 [EMAIL PROTECTED] <[EMAIL PROTECTED]>: >> On 20 июн, 11:06, Wacek Kusnierczyk >> <[EMAIL PROTECTED]> wrote: >>> the result may be that the more beautiful the code, the more the performance >>> sucks. >> >> Sad but true. > > If you do nothing

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread Marc Schwartz
on 06/20/2008 10:04 AM hadley wickham wrote: If you do nothing to your code, in 18 months time its performance will have doubled because computers will have become faster. Your code will not get easier to understand by itself. I suspect a good "fortunes" candidate... :-) Marc _

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread hadley wickham
2008/6/20 [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > On 20 июн, 11:06, Wacek Kusnierczyk > <[EMAIL PROTECTED]> wrote: >> the result may be that the more beautiful the code, the more the performance >> sucks. > > Sad but true. If you do nothing to your code, in 18 months time its performance will hav

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread [EMAIL PROTECTED]
On 20 июн, 11:06, Wacek Kusnierczyk <[EMAIL PROTECTED]> wrote: > the result may be that the more beautiful the code, the more the performance > sucks. Sad but true. Andrey __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-hel

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread Simon Blomberg
From: Wacek Kusnierczyk [mailto:[EMAIL PROTECTED] Sent: Fri 20/06/2008 5:06 PM To: R help Cc: Simon Blomberg Subject: Re: [R] Programming Concepts and Philosophy Simon Blomberg wrote: > I try to use a functional programming style. I define functions within > functions when it is helpful

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread Spencer Graves
Maybe I missed it, but I haven't seen in this tread mention of Venables and Ripley (2000) S Programming (Springer). I found it interesting and useful, though I have not used it as much as MASS -- partly because it is more specialized and it's coverage is not as broad. Spencer hadl

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread hadley wickham
> However, on a more fundamental "programming philosophy" note, the fact > that R does not allow multiple references to one object is a limitation. > One of the fundamental principles of good programming is that there > should be a one-to-one correspondence between instances in the program > and ob

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread Jan T. Kim
On Fri, Jun 20, 2008 at 09:06:24AM +0200, Wacek Kusnierczyk wrote: > Simon Blomberg wrote: > > I try to use a functional programming style. I define functions within > > functions when it is helpful in terms of information hiding. I avoid > > writing functions with side-effects as much as possible,

Re: [R] Programming Concepts and Philosophy

2008-06-20 Thread Wacek Kusnierczyk
Simon Blomberg wrote: > I try to use a functional programming style. I define functions within > functions when it is helpful in terms of information hiding. I avoid > writing functions with side-effects as much as possible, so the only > communication of the called function with the caller functio

Re: [R] Programming Concepts and Philosophy

2008-06-19 Thread Simon Blomberg
I try to use a functional programming style. I define functions within functions when it is helpful in terms of information hiding. I avoid writing functions with side-effects as much as possible, so the only communication of the called function with the caller function is through the arguments and

Re: [R] programming question

2007-10-18 Thread jim holtman
I am not sure I understand your question. I get the following output from your code and it does not look like act.surv.time is repeated: > m treat strata time censorTime act.surv.time censoring [1,] 1 1 0.8331923 0.654723930.65472393 1 [2,] 1 1 0.33

Re: [R] programming question

2007-09-17 Thread Adrian Dusa
On Monday 17 September 2007, you wrote: > R 2.6.0 has Reduce; > > myvec <- c(2, 8, 24, 26, 51, 57, 58, 78, 219) > Reduce(function(myvec, p) setdiff(myvec, findSubsets2(p)), myvec, myvec) Thanks Gabor, at first I jumped off my chair but... for many input variables it takes to reduce the vector. M

Re: [R] programming question

2007-09-17 Thread Gabor Grothendieck
R 2.6.0 has Reduce; myvec <- c(2, 8, 24, 26, 51, 57, 58, 78, 219) Reduce(function(myvec, p) setdiff(myvec, findSubsets2(p)), myvec, myvec) On 9/16/07, Adrian Dusa <[EMAIL PROTECTED]> wrote: > > Dear list, > > I have a vector of numbers, let's say: > > myvec <- c(2, 8, 24, 26, 51, 57, 58, 78, 219