In R, package xts, how would one iterate period subsetting over a list without throwing errors?

StackOverflow https://stackoverflow.com/questions/8903806

Pergunta

Assume:

  • list of n xts objects in .GlobalEnv with the suffix ".raw" (e.g: ABC.raw)
  • have created a list of .raw names in a list (ie, rawfiles <- ls(pattern="*.raw",envir=.GlobalEnv))

Would like to:

  • loop or lapply through rawfiles and subset a particular timeperiod in each iteration
  • for example, to write this as a single line would be: new <- ABC.raw["T09:00/T10:00"] if I wanted to subset ABC.raw from 9am to 10am each day.

The problem is:

  • Doesn't seem to be an easy way of passing["Thh:mm/Thh:mm"] to a loop, apply or assign without causing errors.

Any ideas how to pass this?

In pidgeon code, I guess I'm looking for a working equivalent of:

for(i in 1:length(raw)){
    raw[i]["T09:00/T10:00"]
}

Many thanks in advance for any assistance on this.

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top