[R-sig-eco] Assigning Rank to Temporal Data

Levy, Yair yair.levy at mow.vlaanderen.be
Wed Mar 12 12:46:57 CET 2014


Hi Stacy,

To start simple, a loop is written as follows in R:

For (i in 1 : x){  }

If by ranking, you mean ordering data, than you can use package chron to create time objects that are to my opinion practical to use.

If by ranking you meant classifying your data in function of tide classes, you could perhaps skip using a loop by using functions which() or conditional operators.

For example:

You'd be ultimately aiming at testing two objects (vectors or others). You could script as follows,

Hightideindex <- which(tide == hightide)
Lowtideindex <- which(tide == lowtide)

fishhomerangehightide <- fishposition[which(fishposition == hightideindex)
fishhomerangelowtide <- fishposition[which(fishposition == lowtideindex)

t.test(fishhomerangehightide, fishhomerangelowtide)

Personally I thought about function t.test for student’s test. But may be you’re aware of any other more practical function to calculate this test? If you do, please let me know.

Best regards from Belgium,

PS: did you know that bierwagen actually means a beer car over here in the brewery country? Any roots from these parts? Israel IZ Kamakawiwo ‘Ole is alive!!!

Aloha,


Yaïr Levy


________________________________________
Van: r-sig-ecology-bounces at r-project.org [r-sig-ecology-bounces at r-project.org] namens Stacy Bierwagen [sbierwag at hawaii.edu]
Verzonden: dinsdag 11 maart 2014 23:28
Aan: r-sig-ecology at r-project.org
Onderwerp: [R-sig-eco] Assigning Rank to Temporal Data

Hello Listers,

I am tracking home ranges of herbivorous reef fish and I have an extremely
large data set that includes 300,000 time-stamped lat/long coordinates. I
would like to assign a rank number to date/time in order to test position
of fish versus tidal level. I only have only taken tide level 4x/day so I
would like to create a function that ranks my temporal lat/long data as
presence/absence (0/1) of high tide or low tide to see if this
environmental factor significantly affects movement by using T-testing. I
am not sure how I would go about making a loop or incrementing an "i" value
to represent this in R. Should I first assign a numerical value to the
date/time before I try to quantify this?

I included headers of the data I am looking at below if this helps.

Stacy Bierwagen

TIDE DATA
date time tidal height
days since day 0 time as 24h fraction h since day 0
days since day 0 tidal height
 6/1/2013 4:13 0.33
0 0.175694444 4.216666667
0.175694444 0.33
 6/1/2013 11:05 1.31
0 0.461805556 11.08333333
0.461805556 1.31
 6/1/2013 14:31 1.04
0 0.604861111 14.51666667
0.604861111 1.04
 6/1/2013 21:25 1.66
0 0.892361111 21.41666667
0.892361111 1.66
 6/2/2013 4:49 0.1

TEMPORAL DATA:
   Date TimeGMT DTHI DTConvertHI TConvertHI Frequency Signal Gain (dB)
Latitude Longitude  6/14/2013 23:52:52.336 06142013 23:52:52.336 06142013
13:52:52.336 13:52:52.000 63 86 0 21.43267 -157.791  6/14/2013
23:52:50.295 06142013
23:52:50.295 06142013 13:52:50.295 13:52:50.000 63 90 0 21.43267 -157.791
6/14/2013 23:52:38.051 06142013 23:52:38.051 06142013 13:52:38.051
13:52:38.000 63 88 0 21.43267 -157.791  6/14/2013 23:52:37.032 06142013
23:52:37.032 06142013 13:52:37.032 13:52:37.000 63 86 0 21.43267 -157.791

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


More information about the R-sig-ecology mailing list