Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Collar_height field and merge data from Google sheet #84

Merged
merged 3 commits into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
17 changes: 10 additions & 7 deletions R/srdb_check.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
check_numeric <- function(d, dname = deparse(substitute(d))) {
message("Checking ", dname, " is numeric")
if(!is.numeric(d)) {
warning(paste(dname, " is not numeric"))
d[ d == "" ] <- "0" # don't want blanks to be listed below
message(paste("- in records: ", paste(which(is.na(as.numeric(d))), collapse = " ")))
stop(paste(dname, " is not numeric",
paste("- in records: ", paste(which(is.na(as.numeric(d))), collapse = " "))))
}
invisible(is.numeric(d))
}
Expand Down Expand Up @@ -39,16 +39,15 @@ check_labels <- function(d, labs, dname = deparse(substitute(d))) { # d should
}
}
check_fieldnames <- function(d, d_info) {
browser()
fnames <- as.character(d_info[ d_info[, 2] != "", 2 ]) # Names in the srdb-data_fields.txt file
ndb <- names(d)

if(all(ndb == fnames)) {
if(identical(sort(ndb), sort(fnames))) {
message("All names match between data and info files!")
} else {
message("Following names do not match between field descriptions file and database:")
mismatch <- ndb != fnames
warning(c(rownumber = which(mismatch), data = ndb[ which(mismatch) ],
descrip = fnames[ which(mismatch) ]))
diffs <- union(setdiff(ndb, fnames), setdiff(fnames, ndb))
stop("Following names do not match between field descriptions file and database:", paste(diffs, collapse = ", "))
}
}

Expand Down Expand Up @@ -132,6 +131,10 @@ with(srdb, {
# TODO: meas_method one of a few values
check_bounds(Meas_interval, c(0.01, 365))
check_bounds(Annual_coverage, c(0.01, 1))
check_bounds(Collar_height, c(0, 100))
check_bounds(Collar_depth, c(0, 20))
check_bounds(Chamber_area, c(1, 10000))

# TODO: Partition_method one of a few values

check_bounds(Rs_annual, c(-200, 25000))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Changelog

Date | Change
-------- | ------------------------------------------------------------
20200220 | Removed fields `Rs_max`, `Rs_maxday`, `Rs_min`, and `Rs_minday` from database; they haven't been used and are very inconsistent.
20200220 | Removed fields `Rs_max`, `Rs_maxday`, `Rs_min`, and `Rs_minday` from database; they haven't been used and are very inconsistent. Added `Collar_height` and merged a bunch of new data for that fields as well as `Collar_depth`, `Chamber_area`, and `Time_of_day`.
20191103 | New fields (`Collar_depth`, `Chamber_area`, `Time_of_day`); first data from interns Darlin P. and Jason M.; data corrections by [@jinshijian](https://github.com/jinshijian)
20190915 | Added lots of new data entered by [@rbcmrchs](https://github.com/rbcmrchs) and [@jinshijian](https://github.com/jinshijian); corrections to older data; broke equations columns into separate, new `srdb-equations.csv` file.
20190306 | Many corrections to longitude and latitude data; see issue #22. Thanks to [@jinshijian](https://github.com/jinshijian).
Expand Down
Loading