简体   繁体   English

从一个数据集中提取数据,在r中使用另一个

[英]Extracting data from one data set, using another in r

I am trying to extract data from one data set (contains water quality data -- chlorophyll, dissolved oxygen, temp, etc), using information from another data set that contains tidal information (low tide times). 我正在尝试使用来自另一个包含潮汐信息(潮汐时间低)的数据集的信息,从一个数据集(包含水质数据-叶绿素,溶解氧,温度等)中提取数据。

Background: It has recently come to my attention that due to hydrodynamics it will be best to only look at WQ data points measured at low tide, when I had previously just taken the daily average. 背景:最近引起我注意的是,由于流体动力学的原因,最好只查看退潮时测得的WQ数据​​点,而之前我只是采用每日平均值。

Is there a way I can extract specific WQ data based on if it aligns with date/time of the tidal data??? 有没有一种方法可以根据潮汐数据的日期/时间对齐提取特定的WQ数据​​??? Caveats -- the times might not match up exactly, WQ data was measured every 15 minutes so I need the closest point(s) to the low tide time. 注意事项-时间可能不完全匹配,WQ数据每15分钟测量一次,所以我需要最接近潮汐时间的点。

It is difficult to give the exact code without knowing the frequency of your tidal data. 如果不知道潮汐数据的频率,很难给出确切的代码。 However, you can take a look at the following links, using which you could match the timestamps on both your datasets by rounding them off to the nearest hour/half hour/quarter hour (as the case may be): 但是,您可以查看以下链接,通过将它们四舍五入到最接近的小时/半小时/四分之一小时(视情况而定),可以使用它们来匹配两个数据集上的时间戳:

  1. rounding times to the nearest hour in R 将时间四舍五入到R中最接近的小时
  2. Rounding time to nearest quarter hour 四舍五入到最接近的四分之一小时

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM