> > Wacek: > >> x[3:] > >> instead of > >> x[3:length(x)] > >> x[3:end] > > > > I don't think that would help: > > what to use for end - 3 within the convention that negative values mean > > exclusion? > > might seem tricky, but not impossible: > > x[-2] > # could mean 'all except for 2nd', as it is now > > x[1:-2] > # could mean 'from start to the 2nd backwards from the end' I know you get thus far. You might even think to decide whether exclusion or 'from the end' is meant from ascending ./. descending order of the sequence, but this messes around with returning the reverse order.
> since r disallows mixing positive and negative indexing, the above would > not be ambiguous. worse with > > x[-3:-1] > > which could mean both 'except for 3rd, 2nd, and 1st' and 'from the 3rd > to the 1st from the end', and so would be ambiguous. in this context, > indeed, having explicit 'end' could help avoid the ambiguity. that's the problem. also: how would 'except from the 5th last to the 3rd last' be expressed? You won't get 2 independent things into one sign without trouble. Claudia -- Claudia Beleites Dipartimento dei Materiali e delle Risorse Naturali Università degli Studi di Trieste Via Alfonso Valerio 6/a I-34127 Trieste phone: +39 (0 40) 5 58-34 47 email: cbelei...@units.it ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.