In order to glue tide height (or tide current) onto each fish position
observation:

1: Convert dates & times to POSIXct (do it all in GMT to avoid DST issues!).
2: Consider using NOAA tide data, available as 6 minute interval time
series http://tidesandcurrents.noaa.gov/api/ .  Luke Miller has functions
for scraping their website (
http://lukemiller.org/index.php/2011/02/accessing-noaa-tide-data-with-r/ )
or I have a function:
https://drive.google.com/file/d/0B-vmKFnoibOpVzRXNWxTZkthSm8/edit?usp=sharing
3: Convert dates to POSIXct, then data to ts.
4: Linearly interpolate the tide data to the times of your fish position.
5: glue tide data to fish data.
6:  Use cut() or more complex computations to make your categorical tide
status factor.

I hope that this helps...
Tom 2



On Tue, Mar 11, 2014 at 3:28 PM, Stacy Bierwagen <sbierwag@hawaii.edu>wrote:

> 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@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



-- 
-------------------------------------------
Tom Philippi, Ph.D.
Quantitative Ecologist & Data Therapist
Inventory and Monitoring Program
National Park Service
Tom_Philippi@nps.gov
http://science.nature.nps.gov/im/monitor

	[[alternative HTML version deleted]]

