Re: [R] for loop is looping only once

2016-11-17 Thread Duncan Murdoch
On 17/11/2016 6:26 AM, Ulrik Stervbo wrote: Hi Georg, Your for loop iterates over just one value, to get it to work as you intend use for(item in 1:length(kpis)){} That usually works, but fails often enough that we recommend using for (item in seq_along(kpis)) {} (The failures happen if

Re: [R] for loop is looping only once

2016-11-17 Thread Ulrik Stervbo
Hi Georg, Your for loop iterates over just one value, to get it to work as you intend use for(item in 1:length(kpis)){} HTH Ulrik On Thu, 17 Nov 2016 at 12:18 wrote: > Hi All, > > I need to execute a loop on variables to compute several KPIs. > Unfortunately the for

[R] for loop is looping only once

2016-11-17 Thread G . Maubach
Hi All, I need to execute a loop on variables to compute several KPIs. Unfortunately the for loop is executed only once for the last KPI given. The code below illustrates my current solution but is not completely necessary to spot the problem. I just give an idea what I am doing overall.