[R] computing differences between consecutive vector elements

Dewez Thomas t.dewez at brgm.fr
Tue Jul 27 16:44:59 CEST 2004


Dear R-users,

I am a newbie to R so please excuse this naive question for which I couldn't
seem to find online answers.

I have this data frame containing a series of locations through time
(x,y,z,t). I would like to compute the difference in x, y and z between t-1
and t.

Sounds easy enough, but how on earth does one loop through vector elements
and compute this difference?

Thanks

Thomas
***
Le contenu de cet e-mail et de ses pièces jointes est destiné à l'usage exclusif du 
(des) destinataire(s) expressément désigné(s) comme tel(s). En cas de réception de cet 
 e-mail par erreur, le signaler à son expéditeur et ne pas en divulguer le contenu. 
L'absence de virus a été vérifié à  l'émission du message. Il convient néanmoins de 
vérifier l'absence de corruption à sa réception.

The contents of this email and any attachments are confidential. They are intended for 
the named recipient(s) only. If you have received this email in error please notify the 
system manager or  the sender immediately and do not disclose the contents to 
anyone or make copies. eSafe scanned this email for viruses, vandals and malicious 
content.
***




More information about the R-help mailing list