-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated fulltext search source data to use get_OSD output
- Loading branch information
1 parent
b201838
commit 7dc67f1
Showing
3 changed files
with
177 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
library(soilDB) | ||
|
||
|
||
x <- get_OSD('peters') | ||
|
||
# remove section title, not present in all sections | ||
cleanSectionTitle <- function(s) { | ||
.text <- gsub(pattern = "^[a-zA-Z1-9 ]+\\s?:\\s*", replacement = "", x = s) | ||
return(.text) | ||
} | ||
|
||
# section chunks | ||
chunkNames <- c("OVERVIEW", | ||
"TAXONOMIC.CLASS", "TYPICAL.PEDON", "TYPE.LOCATION", "RANGE.IN.CHARACTERISTICS", | ||
"COMPETING.SERIES", "GEOGRAPHIC.SETTING", "GEOGRAPHICALLY.ASSOCIATED.SOILS", | ||
"DRAINAGE.AND.PERMEABILITY", "USE.AND.VEGETATION", "DISTRIBUTION.AND.EXTENT", | ||
"REGIONAL.OFFICE", "ORIGIN", "REMARKS", "ADDITIONAL.DATA") | ||
|
||
# iterate over subset of section names, just those we intend to insert into the OSD table | ||
x.clean <- lapply(chunkNames, function(i) { | ||
# remove section title if present | ||
res <- cleanSectionTitle(x[[i]]) | ||
return(res) | ||
}) | ||
|
||
# reset names | ||
names(x.clean) <- chunkNames | ||
|
||
|
||
|