Re: [R] Deltas or changes

2010-03-10 Thread Kevin E. Thorpe
ManInMoon wrote: Because I am asking for help... In the time it has taken for you to ask your question and wait for answers, you could have experimented yourself and actually learned something. The only way you will learn the language is to actually try using the language. On 10 March

Re: [R] Deltas or changes

2010-03-10 Thread ManInMoon
Thank you! On 10 March 2010 21:21, David Winsemius [via R] < ml-node+1588077-2145101402-180...@n4.nabble.com > wrote: > > On Mar 10, 2010, at 2:50 PM, ManInMoon wrote: > > > > > It does help much. > > > > Just one line about x[-1] > > > > Is there more comprehensive help anywhere? > > http://cra

Re: [R] Deltas or changes

2010-03-10 Thread David Winsemius
On Mar 10, 2010, at 2:50 PM, ManInMoon wrote: It does help much. Just one line about x[-1] Is there more comprehensive help anywhere? http://cran.r-project.org/doc/manuals/R-lang.html#Indexing -- View this message in context: http://n4.nabble.com/Deltas-or-changes-tp1585960p1587939.htm

Re: [R] Deltas or changes

2010-03-10 Thread ManInMoon
Because I am asking for help... On 10 March 2010 20:19, Kevin E. Thorpe [via R] < ml-node+1587986-1699461774-180...@n4.nabble.com > wrote: > ManInMoon wrote: > > Hi, I am new to R. > > > > What does a negative amount in an index do? > > > > i.e. x[-lenght[x]] > > > Why don't you try it and see f

Re: [R] Deltas or changes

2010-03-10 Thread ManInMoon
It does help much. Just one line about x[-1] Is there more comprehensive help anywhere? -- View this message in context: http://n4.nabble.com/Deltas-or-changes-tp1585960p1587939.html Sent from the R help mailing list archive at Nabble.com. __ R-help

Re: [R] Deltas or changes

2010-03-10 Thread Kevin E. Thorpe
ManInMoon wrote: Hi, I am new to R. What does a negative amount in an index do? i.e. x[-lenght[x]] Why don't you try it and see for yourself? -- Kevin E. Thorpe Biostatistician/Trialist, Knowledge Translation Program Assistant Professor, Dalla Lana School of Public Health University of Tor

Re: [R] Deltas or changes

2010-03-10 Thread Ista Zahn
Please learn to Read The Fine Manual: ?"[" will give you the answer. -Ista On Wed, Mar 10, 2010 at 8:43 AM, ManInMoon wrote: > > Hi, I am new to R. > > What does a negative amount in an index do? > > i.e. x[-lenght[x]] > -- > View this message in context: > http://n4.nabble.com/Deltas-or-chan

Re: [R] Deltas or changes

2010-03-10 Thread ManInMoon
Hi, I am new to R. What does a negative amount in an index do? i.e. x[-lenght[x]] -- View this message in context: http://n4.nabble.com/Deltas-or-changes-tp1585960p1587408.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pro

Re: [R] Deltas or changes

2010-03-09 Thread Ben Bolker
Henrique Dallazuanna gmail.com> writes: > Reduce("/", as.data.frame(embed(x, 2))) > > ManInMoon googlemail.com> wrote: > > > > How can I generate a vector of differences between each > elemtn of an vector? (you mean ratios, right?) > > > > i.e. a[i]=x[i]/x[i-1] x[-1]/x[-length(x)] mig

Re: [R] Deltas or changes

2010-03-09 Thread Karl Ove Hufthammer
On Tue, 9 Mar 2010 05:37:52 -0800 (PST) ManInMoon wrote: > How can I generate a vector of differences between each elemtn of an vector? diff(x) -- Karl Ove Hufthammer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help P

Re: [R] Deltas or changes

2010-03-09 Thread Henrique Dallazuanna
You can try this: Reduce("/", as.data.frame(embed(x, 2))) On Tue, Mar 9, 2010 at 10:37 AM, ManInMoon wrote: > > How can I generate a vector of differences between each elemtn of an vector? > > i.e. a[i]=x[i]/x[i-1] > -- > View this message in context: > http://n4.nabble.com/Deltas-or-changes-tp

Re: [R] Deltas or changes

2010-03-09 Thread Dimitris Rizopoulos
try this: x <- runif(100) a <- x[-1] / x[-length(x)] a I hope it helps. Best, Dimitris On 3/9/2010 2:37 PM, ManInMoon wrote: How can I generate a vector of differences between each elemtn of an vector? i.e. a[i]=x[i]/x[i-1] -- Dimitris Rizopoulos Assistant Professor Department of Biost

[R] Deltas or changes

2010-03-09 Thread ManInMoon
How can I generate a vector of differences between each elemtn of an vector? i.e. a[i]=x[i]/x[i-1] -- View this message in context: http://n4.nabble.com/Deltas-or-changes-tp1585960p1585960.html Sent from the R help mailing list archive at Nabble.com. ___