Skip to content

Commit e515396

Browse files
Add rodent census 541 data [minor] (#590)
* Add rodent census 541 data [minor] * Let new moon script use predetermined new moon dates [minor] The new moon script fetches official new moon dates using the lunar package. It adds them as they occur to the moon_dates.csv. Then, when the rodent data are added, it fetches those dates again to pair the new period with the closest unassigned new moon. Which shouldn't be a problem, they should be exactly the same. But I think, especially once the new moon is far in the past, it may arbitrarily choose one day or another when it spans both. So I've just switched that section of the script to use the new moon date from the moon_dates.csv, instead of recalculating it when it already exists. --------- Co-authored-by: Glenda Yenni <glenda@weecology.org>
1 parent ea3b625 commit e515396

File tree

3 files changed

+66
-4
lines changed

3 files changed

+66
-4
lines changed

DataCleaningScripts/new_moon_numbers.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# some code to match new moon dates to period sampling dates
2-
2+
33
`%>%` <- magrittr::`%>%`
44

55
#' Find date of first trapping night for each period in a data frame
@@ -84,7 +84,7 @@ update_moon_dates <- function() {
8484
if(any(as.character(newmoondates$newmoondate) %in% as.character(moon_dates$newmoondate))) {
8585
# match new period to closest NewMoonDate,
8686
for(i in 1:dim(newperiod_dates)[1]) {
87-
closest = as.character(closest_newmoon(newperiod_dates$censusdate[i],newmoondates$newmoondate))
87+
closest = as.character(closest_newmoon(newperiod_dates$censusdate[i],moon_dates$newmoondate))
8888
moon_dates$censusdate[as.character(moon_dates$newmoondate)==closest]=newperiod_dates$censusdate[i]
8989
moon_dates$period[as.character(moon_dates$newmoondate)==closest]=newperiod_dates$period[i]
9090
}

DataCleaningScripts/new_rodent_data.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This script is for cleaning new rodent data. Data must first be entered in two separate sheets in
22
# an excel file, by two different people to reduce entry error.
3-
3+
44

55
library(openxlsx, warn.conflicts=FALSE, quietly = TRUE)
66
library(sqldf, warn.conflicts=FALSE, quietly = TRUE)
@@ -15,7 +15,7 @@ source('DataCleaningScripts/clean_pit_tags.R')
1515
# New file to be checked
1616
##############################################################################
1717

18-
newperiod = '540'
18+
newperiod = '541'
1919

2020
filepath = "~/Dropbox/Portal/PORTAL_primary_data/Rodent/Raw_data/New_data"
2121

Rodents/Portal_rodent.csv

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78976,3 +78976,65 @@
7897678976
79079,6,1,2025,540,7,,41,"PP","F","Z",,,,,,,19,15,"79C80A",,,,,,,,,,,
7897778977
79080,6,1,2025,540,10,,53,"RM","F","Z",,,,,,,12,8,,,,,,,,,,"R",,
7897878978
79081,6,1,2025,540,9,2,,,,,,,,,,,,,,,,,,,,,,,,
78979+
79082,7,2,2025,541,1,2,,,,,,,,,,,,,,,,,,,,,,,,
78980+
79083,7,2,2025,541,4,,37,"PP","M",,,"S",,,,,18,15,"05C4CB",,,,,,,,,,,
78981+
79084,7,2,2025,541,6,,43,"DM","M",,,"S",,,,,33,41,"BF0CDC",,,,,,,,,,,
78982+
79085,7,2,2025,541,6,,44,"DM","M",,,"S",,,,,35,46,"79C61F",,,,,,,,,,,
78983+
79086,7,2,2025,541,6,,71,"PP","F","Z",,,,,,,19,16,"79FAC1",,,,,,,,,,,
78984+
79087,7,2,2025,541,11,,14,"DM","M",,,"R",,,,,35,38,"7998A2",,,,,,,,,,,
78985+
79088,7,2,2025,541,18,,12,"DM","F","Z",,,,,,,36,53,"79D50F",,,,,,,,,,,
78986+
79089,7,2,2025,541,19,,57,"PP","F","Z",,,,,,,20,17,"793E65","*",,,,,,,,,,
78987+
79090,7,2,2025,541,24,13,76,"AH",,,,,,,,,,,,,,,,,,,,"R",,
78988+
79091,7,2,2025,541,20,,32,"DM","F","Z",,,,,,,35,41,"79FAF9",,,,,,,,,,,
78989+
79092,7,2,2025,541,20,,61,"PP","M",,,"M",,,,,20,20,"79D516",,,,,,,,,,,
78990+
79093,7,2,2025,541,21,,15,"PP","M",,,"R",,,,,21,19,"05BB8A",,,,,,,,,,,
78991+
79094,7,2,2025,541,21,,17,"PP","M",,,"R",,,,,20,19,"79973C",,,,,,,,,,,
78992+
79095,7,2,2025,541,21,,37,"PP","F",,,,,"P",,,20,20,"795C57",,,,,,,,,,,
78993+
79096,7,2,2025,541,21,,75,"PP","M",,,"S",,,,,20,21,"79D66E",,,,,,,,,,,
78994+
79097,7,2,2025,541,21,,12,"PP","F",,,,,,"E",,20,18,"05C4D2",,,,,,,,,,,
78995+
79098,7,2,2025,541,22,,75,"PB","F","Z",,,,,,,21,26,"05C4C0",,,,,,,,,,,
78996+
79099,7,2,2025,541,23,,13,"PP","F","Z",,,,,,,20,18,"79A04E",,,,,,,,,"R",,
78997+
79100,7,2,2025,541,12,2,,,,,,,,,,,,,,,,,,,,,,,,
78998+
79101,7,2,2025,541,2,2,,,,,,,,,,,,,,,,,,,,,,,,
78999+
79102,7,2,2025,541,3,2,,,,,,,,,,,,,,,,,,,,,,,,
79000+
79103,7,2,2025,541,5,2,,,,,,,,,,,,,,,,,,,,,,,,
79001+
79104,7,2,2025,541,7,2,,,,,,,,,,,,,,,,,,,,,,,,
79002+
79105,7,2,2025,541,8,2,,,,,,,,,,,,,,,,,,,,,,,,
79003+
79106,7,2,2025,541,9,2,,,,,,,,,,,,,,,,,,,,,,,,
79004+
79107,7,2,2025,541,10,2,,,,,,,,,,,,,,,,,,,,,,,,
79005+
79108,7,2,2025,541,13,2,,,,,,,,,,,,,,,,,,,,,,,,
79006+
79109,7,2,2025,541,14,2,,,,,,,,,,,,,,,,,,,,,,,,
79007+
79110,7,2,2025,541,15,2,,,,,,,,,,,,,,,,,,,,,,,,
79008+
79111,7,2,2025,541,16,2,,,,,,,,,,,,,,,,,,,,,,,,
79009+
79112,7,2,2025,541,17,2,,,,,,,,,,,,,,,,,,,,,,,,
79010+
79113,7,2,2025,541,1,2,,,,,,,,,,,,,,,,,,,,,,,,
79011+
79114,7,2,2025,541,4,,37,"PP","M",,,"S",,,,,18,15,"05C4CB",,,,,,,,,,,
79012+
79115,7,2,2025,541,6,,43,"DM","M",,,"S",,,,,33,41,"BF0CDC",,,,,,,,,,,
79013+
79116,7,2,2025,541,6,,44,"DM","M",,,"S",,,,,35,46,"79C61F",,,,,,,,,,,
79014+
79117,7,2,2025,541,6,,71,"PP","F","Z",,,,,,,19,16,"79FAC1",,,,,,,,,,,
79015+
79118,7,2,2025,541,11,,14,"DM","M",,,"R",,,,,35,38,"7998A2",,,,,,,,,,,
79016+
79119,7,2,2025,541,18,,12,"DM","F","Z",,,,,,,36,53,"79D50F",,,,,,,,,,,
79017+
79120,7,2,2025,541,19,,57,"PP","F","Z",,,,,,,20,17,"793E65","*",,,,,,,,,,
79018+
79121,7,2,2025,541,24,13,76,"AH",,,,,,,,,,,,,,,,,,,,"R",,
79019+
79122,7,2,2025,541,20,,32,"DM","F","Z",,,,,,,35,41,"79FAF9",,,,,,,,,,,
79020+
79123,7,2,2025,541,20,,61,"PP","M",,,"M",,,,,20,20,"79D516",,,,,,,,,,,
79021+
79124,7,2,2025,541,21,,15,"PP","M",,,"R",,,,,21,19,"05BB8A",,,,,,,,,,,
79022+
79125,7,2,2025,541,21,,17,"PP","M",,,"R",,,,,20,19,"79973C",,,,,,,,,,,
79023+
79126,7,2,2025,541,21,,37,"PP","F",,,,,"P",,,20,20,"795C57",,,,,,,,,,,
79024+
79127,7,2,2025,541,21,,75,"PP","M",,,"S",,,,,20,21,"79D66E",,,,,,,,,,,
79025+
79128,7,2,2025,541,21,,12,"PP","F",,,,,,"E",,20,18,"05C4D2",,,,,,,,,,,
79026+
79129,7,2,2025,541,22,,75,"PB","F","Z",,,,,,,21,26,"05C4C0",,,,,,,,,,,
79027+
79130,7,2,2025,541,23,,13,"PP","F","Z",,,,,,,20,18,"79A04E",,,,,,,,,"R",,
79028+
79131,7,2,2025,541,12,2,,,,,,,,,,,,,,,,,,,,,,,,
79029+
79132,7,2,2025,541,2,2,,,,,,,,,,,,,,,,,,,,,,,,
79030+
79133,7,2,2025,541,3,2,,,,,,,,,,,,,,,,,,,,,,,,
79031+
79134,7,2,2025,541,5,2,,,,,,,,,,,,,,,,,,,,,,,,
79032+
79135,7,2,2025,541,7,2,,,,,,,,,,,,,,,,,,,,,,,,
79033+
79136,7,2,2025,541,8,2,,,,,,,,,,,,,,,,,,,,,,,,
79034+
79137,7,2,2025,541,9,2,,,,,,,,,,,,,,,,,,,,,,,,
79035+
79138,7,2,2025,541,10,2,,,,,,,,,,,,,,,,,,,,,,,,
79036+
79139,7,2,2025,541,13,2,,,,,,,,,,,,,,,,,,,,,,,,
79037+
79140,7,2,2025,541,14,2,,,,,,,,,,,,,,,,,,,,,,,,
79038+
79141,7,2,2025,541,15,2,,,,,,,,,,,,,,,,,,,,,,,,
79039+
79142,7,2,2025,541,16,2,,,,,,,,,,,,,,,,,,,,,,,,
79040+
79143,7,2,2025,541,17,2,,,,,,,,,,,,,,,,,,,,,,,,

0 commit comments

Comments
 (0)