Re: [R] Function help

2015-10-26 Thread Jim Lemon
Hi Alexander, I suspect that when you write "try" you mean that you try to run the function with some value for "pid". The "unexpected symbol" error message usually includes the offending symbol and that will probably identify the problem. Jim On Mon, Oct 26, 2015 at 1:20 PM, wrote: > Hello, >

Re: [R] Function help

2015-10-26 Thread Duncan Murdoch
On 25/10/2015 10:20 PM, alexander.thoma...@louisville.edu wrote: > Hello, > > I'm following an example in the book, analyzing baseball data with R, but > it's not working for me. The example is: We don't know what "the book" is. If this is the textbook for your class, you should ask your instru

[R] Function help

2015-10-26 Thread alexander . thomas . 1
Hello, I'm following an example in the book, analyzing baseball data with R, but it's not working for me. The example is: compute.hr <- function(pid){d <- subset(Batting.60, playerID==pid) sum(d$HR)} Every time I try this, it says there's an unexpected symbol. Any idea on what the unexpected s

Re: [R] R function help!

2013-02-18 Thread Rolf Turner
Pete: Please don't do people's homework for them! At most, give them a ***hint*** only. cheers, Rolf Turner On 02/19/2013 12:01 PM, Pete Brecknock wrote: simonj16 wrote Consider an urn that contains 10 tickets, labelled: 1,1,1,1,2,5,5,10,10,10 I want to draw with replacement n=

Re: [R] R function help!

2013-02-18 Thread Pete Brecknock
> > Follow up question: > > Use urn.model to generate a sample y={y1,...,y25) of n=25 observed sums. Any good? ticket.ns<-c(1,1,1,1,2,5,5,10,10,10) draw=NULL for (i in 1:25){ draw[i] <- sum(sample(ticket.ns,40,replace=TRUE)) } print(draw) HTH Pete -- View this message

Re: [R] function help?

2010-09-21 Thread Cormac Long
Hi there Petr, Apologies for only replying to your post now - I hope the code included below helps you out. An alternative function documentation approach would be the one I took when faced with a similar problem - I wrote some functions to allow me to embed a retrievable function specification i

Re: [R] function help?

2010-09-20 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 17.09.2010 17:02:29: > On 9/16/10 5:00 PM, Rolf Turner wrote: > > On 17/09/2010, at 8:51 AM, Duke wrote: > > > >> Hi Duncan, > >> > >> On 9/16/10 3:47 PM, Duncan Murdoch wrote: > >>> On 16/09/2010 3:40 PM, Duke wrote: > Hi all, > >

Re: [R] function help?

2010-09-17 Thread Duke
On 9/17/10 12:46 PM, Jeff Newmiller wrote: If having the definition of the function appear when you enter the name of the function elicits a "hate" response, then perhaps you should not be using R. That characteristic of R is fundamental and unlikely to change: in R everything is an object, a

Re: [R] function help?

2010-09-17 Thread Jeff Newmiller
If having the definition of the function appear when you enter the name of the function elicits a "hate" response, then perhaps you should not be using R. That characteristic of R is fundamental and unlikely to change: in R everything is an object, and the result of evaluating an expression is d

Re: [R] function help?

2010-09-17 Thread Duke
On 9/16/10 5:00 PM, Rolf Turner wrote: On 17/09/2010, at 8:51 AM, Duke wrote: Hi Duncan, On 9/16/10 3:47 PM, Duncan Murdoch wrote: On 16/09/2010 3:40 PM, Duke wrote: Hi all, I am writing a function (fun.R), but I dont know how to code the function so that the Help Text will be shown u

Re: [R] function help?

2010-09-16 Thread Duncan Murdoch
On 16/09/2010 5:00 PM, Rolf Turner wrote: On 17/09/2010, at 8:51 AM, Duke wrote: Hi Duncan, On 9/16/10 3:47 PM, Duncan Murdoch wrote: On 16/09/2010 3:40 PM, Duke wrote: Hi all, I am writing a function (fun.R), but I dont know how to code the function so that the Help Text will be shown u

Re: [R] function help?

2010-09-16 Thread Rolf Turner
On 17/09/2010, at 8:51 AM, Duke wrote: > Hi Duncan, > > On 9/16/10 3:47 PM, Duncan Murdoch wrote: >> On 16/09/2010 3:40 PM, Duke wrote: >>> Hi all, >>> >>> I am writing a function (fun.R), but I dont know how to code the >>> function so that the Help Text will be shown up when one types ?fun

Re: [R] function help?

2010-09-16 Thread Duke
Hi Duncan, On 9/16/10 3:47 PM, Duncan Murdoch wrote: On 16/09/2010 3:40 PM, Duke wrote: Hi all, I am writing a function (fun.R), but I dont know how to code the function so that the Help Text will be shown up when one types ?fun (of course, after he loads it up). Anyone has any advice for

Re: [R] function help?

2010-09-16 Thread Duncan Murdoch
On 16/09/2010 3:40 PM, Duke wrote: Hi all, I am writing a function (fun.R), but I dont know how to code the function so that the Help Text will be shown up when one types ?fun (of course, after he loads it up). Anyone has any advice for me how to do that? The help text is separate from t

[R] function help?

2010-09-16 Thread Duke
Hi all, I am writing a function (fun.R), but I dont know how to code the function so that the Help Text will be shown up when one types ?fun (of course, after he loads it up). Anyone has any advice for me how to do that? Thanks, D. __ R-help@r-pr

Re: [R] Function Help

2009-10-11 Thread Ben Bolker
cls59 wrote: > > > > jimdare wrote: >> >> Hi there, >> >> I have created the function below: >> >> pirate<-function(x){ >> a<-x-1; b<-a/5; c<-a-b; >> d<-c-1; e<-d/5; f<-d-e; >> g<-f-1; h<-g/5; i<-g-h; >> j<-i-1; k<-j/5; l<-j-k; >> m<-l-1; n<-m/5; o<-m-n; >> final<-o/5; >> >> final >> } >>

Re: [R] Function Help

2009-10-11 Thread cls59
jimdare wrote: > > Hi there, > > I have created the function below: > > pirate<-function(x){ > a<-x-1; b<-a/5; c<-a-b; > d<-c-1; e<-d/5; f<-d-e; > g<-f-1; h<-g/5; i<-g-h; > j<-i-1; k<-j/5; l<-j-k; > m<-l-1; n<-m/5; o<-m-n; > final<-o/5; > > final > } > > I want to run this function until th

[R] Function Help

2009-10-11 Thread jimdare
Hi there, I have created the function below: pirate<-function(x){ a<-x-1; b<-a/5; c<-a-b; d<-c-1; e<-d/5; f<-d-e; g<-f-1; h<-g/5; i<-g-h; j<-i-1; k<-j/5; l<-j-k; m<-l-1; n<-m/5; o<-m-n; final<-o/5; final } I want to run this function until the output ('final') is an exact integer (e.g. 893.000

Re: [R] function help

2008-10-17 Thread Jorge Ivan Velez
Dear Alex, Just a _minor_ change in the function "powers": # powers # n is the number of samples # DATA is the ORIGINAL data set powers=function(n,m2,n2,s2,DATA){ outp=Sample(DATA,n) # DATA was 'name' before, which doesn't make sense mymeans=outp$Gmean mysds=outp$Gsd res=t(rbind(mymeans,m

Re: [R] function help

2008-10-17 Thread Jorge Ivan Velez
Dear Alex, Try this: # Data name=read.table(textConnection(" X8 X9 X10 X102 X110 X177 X283 X284 X286 X292 X297 X306 X308 X314 0 1 000100000000 0 0 001000000010 0 1 0000000

Re: [R] function help

2008-10-17 Thread Dimitris Rizopoulos
take a look at ?mapply(); for instance, you can use something like this (untested): dat <- Sample(...) mapply(Power, dat$Gmean, dat$Gsd, MoreArgs = list(alfa = 0.05, m1 = 57, s1 = 33, n1 = 200, n2 = 100)) I hope it helps. Best, Dimitris Alex99 wrote: Hi everyone, I have dataset which I ma

[R] function help

2008-10-17 Thread Alex99
Hi everyone, I have dataset which I make a sample of it couple of times and each time I get the mean and standard deviation of each row for each sample. I have a function for that, which takes the name of the file and number of times to sample and then returns the mean and standard deviation for e