Skip to content

Commit

Permalink
prepare release v0.1.0
Browse files Browse the repository at this point in the history
- bump version
- run kwb.pkgbuild::use_index_rmd()
- run kwb.pkgbuild::use_readme_md()
- run styler::style_pkg()
- run usethis::use_tidy_versions()
  • Loading branch information
mrustl committed Feb 13, 2019
1 parent 0e4f301 commit 854d6fb
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 133 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
^README\.md$
^.*\.Rproj$
^\.Rproj\.user$
^index\.Rmd$
73 changes: 42 additions & 31 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
Package: kwb.geosalz
Version: 0.0.0.9000
Title: R Package for Documenting Workflow Used in Project "geosalz"
Description: R Package for Documenting Workflow Used in Project "geosalz".
Authors@R: c(person("Michael", "Rustler", , "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0003-0647-7726")),
person("Hauke", "Sonnenberg", , "[email protected]",
role = c("ctb"), comment = c(ORCID = "0000-0001-9134-2871")),
person("Kompetenzzentrum Wasser Berlin gGmbH (KWB)", role = c("cph")))
Title: R Package for Documenting Workflow Used in Project
"geosalz"
Version: 0.1.0
Authors@R:
c(person(given = "Michael",
family = "Rustler",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0003-0647-7726")),
person(given = "Hauke",
family = "Sonnenberg",
role = "ctb",
email = "[email protected]",
comment = c(ORCID = "0000-0001-9134-2871")),
person(given = "Kompetenzzentrum Wasser Berlin gGmbH (KWB)",
role = "cph"))
Description: R Package for Documenting Workflow Used in Project
"geosalz".
License: MIT + file LICENSE
URL: https://github.com/KWB-R/kwb.geosalz
BugReports: https://github.com/KWB-R/kwb.geosalz/issues
Imports:
cellranger,
crayon,
data.table,
dplyr,
fs,
janitor,
kwb.utils,
magrittr,
readxl,
rlang,
stringr,
tidyr
cellranger (>= 1.1.0),
crayon (>= 1.3.4),
data.table (>= 1.12.0),
dplyr (>= 0.7.8),
fs (>= 1.2.6),
janitor (>= 1.1.1),
kwb.utils (>= 0.4.0.9000),
magrittr (>= 1.5),
readxl (>= 1.2.0),
rlang (>= 0.3.1),
stringr (>= 1.4.0),
tidyr (>= 0.8.2)
Suggests:
covr,
ggplot2,
knitr,
rmarkdown,
tibble,
sessioninfo
covr (>= 3.2.1),
ggplot2 (>= 3.1.0),
knitr (>= 1.21),
rmarkdown (>= 1.11),
tibble (>= 2.0.1),
sessioninfo (>= 1.1.1)
VignetteBuilder:
knitr
Remotes:
github::KWB-R/kwb.utils
License: MIT + file LICENSE
ByteCompile: true
Encoding: UTF-8
LazyData: true
ByteCompile: true
URL: https://github.com/KWB-R/kwb.geosalz
BugReports: https://github.com/KWB-R/kwb.geosalz/issues
RoxygenNote: 6.1.1
VignetteBuilder: knitr
22 changes: 10 additions & 12 deletions R/add_lookup_data.R
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
#' get_parameters_meta
#'
#' @param xlsx_path path to EXCEL spreadsheet with parameter metadata
#' @param sheet_name name of sheet containing metadata table
#' @param sheet_name name of sheet containing metadata table
#' (default: "nur Parameterliste")
#' @return imported parameter metadata with cleaned columns names
#' @export
#' @importFrom magrittr "%>%"
#' @importFrom readxl read_excel
#' @importFrom janitor clean_names
#'
#'
get_parameters_meta <- function(xlsx_path,
sheet_name = "nur Parameterliste") {

readxl::read_excel(xlsx_path, sheet = sheet_name) %>%
janitor::clean_names()
}


#' add_para_metadata
#'
#' @param df df
#' @param df df
#' @param lookup_para_path lookup_para_path
#' @param parameters_path parameters_path
#' @importFrom magrittr "%>%"
Expand All @@ -33,7 +32,6 @@ get_parameters_meta <- function(xlsx_path,
add_para_metadata <- function(df,
lookup_para_path,
parameters_path) {

if (file.exists(lookup_para_path)) {
lookup_para <- read.csv(
file = lookup_para_path,
Expand Down Expand Up @@ -100,10 +98,10 @@ add_para_metadata <- function(df,
return(labor_sel)
}

#' add_site_metadata
#' add_site_metadata
#'
#' @param df df
#' @param site_path site_path
#' @param df df
#' @param site_path site_path
#'
#' @return data frame with added site metadata
#' @importFrom magrittr "%>%"
Expand All @@ -112,10 +110,10 @@ add_para_metadata <- function(df,
#' @export
add_site_metadata <- function(df,
site_path) {


sites <- readxl::read_excel(path = site_path,
.name_repair = "minimal") %>%
sites <- readxl::read_excel(
path = site_path,
.name_repair = "minimal"
) %>%
janitor::clean_names() %>%
dplyr::rename(site_id = .data$interne_nr)

Expand Down
52 changes: 26 additions & 26 deletions R/convert_xls_as_xlsx.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ get_excelcnv_exe <- function(office_folder = safe_office_folder()) {
}

#' Helper function: safe_office_folder
#' @param office_path office folder path (default:
#' @param office_path office folder path (default:
#' "C:/Program Files (x86)/Microsoft Office")
#' @return path of office folder (if existing)
#' @importFrom kwb.utils safePath
safe_office_folder <- function(
office_path = "C:/Program Files (x86)/Microsoft Office") {
office_path = "C:/Program Files (x86)/Microsoft Office") {
kwb.utils::safePath(office_path)
}

Expand All @@ -46,7 +46,7 @@ safe_office_folder <- function(
#' @param office_folder office folder path (default: \code{safe_office_folder})
#' @param dbg debug (default: TRUE)
#' @importFrom kwb.utils catIf
#'
#'
delete_registry <- function(office_folder = safe_office_folder(), dbg = TRUE) {
exe_path <- get_excelcnv_exe(office_folder)

Expand Down Expand Up @@ -79,8 +79,8 @@ delete_registry <- function(office_folder = safe_office_folder(), dbg = TRUE) {
#' @export
#'
convert_xls_as_xlsx <- function(input_dir,
export_dir = tempdir(),
office_folder = safe_office_folder(),
export_dir = tempdir(),
office_folder = safe_office_folder(),
dbg = TRUE) {
input_dir <- normalizePath(input_dir)

Expand Down Expand Up @@ -110,11 +110,11 @@ convert_xls_as_xlsx <- function(input_dir,

#' Helper function: convert_xls_to_xlsx
#'
#' @param exe exe
#' @param exe exe
#' @param xls xls
#' @param xlsx xlsx
#' @param i i
#' @param n_files n_files
#' @param n_files n_files
#' @param dbg debug (default: TRUE)
#' @importFrom kwb.utils catIf

Expand All @@ -133,50 +133,50 @@ convert_xls_to_xlsx <- function(exe, xls, xlsx, i, n_files, dbg = TRUE) {
### Uncomment functions created just for testing DRAKE
###############################################################################

# get_file_paths_with_pattern <- function(input_dir,
# get_file_paths_with_pattern <- function(input_dir,
# pattern = "\\.([xX][lL][sS])$") {
# input_dir <- normalizePath(input_dir)
#
#
#
#
#
#
# normalizePath(dir(
# input_dir, pattern,
# recursive = TRUE, full.names = TRUE
# ))
#
#
#
#
# }


# get_xls_file_paths <- function(input_dir, pattern = "\\.([xX][lL][sS])$") {
# get_file_paths_with_pattern(input_dir, pattern)
# }
#
#
# get_xlsx_file_paths <- function(input_dir, pattern = "\\.([xX][lL][sS][xX])$") {
# get_file_paths_with_pattern(input_dir, pattern)
# }
#
#
# convert_xls_as_xlsx2 <- function(xls_paths,
# input_dir,
# export_dir,
# office_folder = safe_office_folder(),
# export_dir,
# office_folder = safe_office_folder(),
# dbg = TRUE) {
# input_dir <- normalizePath(input_dir)
#
#
# export_dir <- normalizePath(export_dir)
#
#
#
#
# xlsx <- gsub(input_dir, export_dir, xls_paths, fixed = TRUE)
#
#
# xlsx <- gsub("\\.([xX][lL][sS])$", ".xlsx", xlsx)
#
#
# fs::dir_create(path = normalizePath(dirname(xlsx)), recursive = TRUE)
#
#
# exe <- normalizePath(get_excelcnv_exe(office_folder))
#
#
# for (i in seq_along(xls_paths)) {
# convert_xls_to_xlsx(exe, xls_paths[i], xlsx[i], i, length(xls_paths), dbg = dbg)
#
#
# delete_registry(office_folder, dbg = dbg)
# }
# }
# }
10 changes: 5 additions & 5 deletions R/copy_lookup_para_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
#' @param to_dir target directory where to copy the xlsx files
#' @param overwrite should existing files be overwritten (TRUE) otherwise (FALSE)
#' ? (default: FALSE)
#' @param recursive if TRUE recursively find all xlsx files in the directory
#' @param recursive if TRUE recursively find all xlsx files in the directory
#' specified in parameter "from_dir" (default: TRUE)
#' @param file_pattern pattern for identifying lookup_para file
#' @param file_pattern pattern for identifying lookup_para file
#' (default: "^lookup_para\\.csv$")
#' @importFrom fs dir_create
#' @importFrom fs file_copy
#' @export
copy_lookup_para_file <- function(from_dir,
to_dir,
overwrite = FALSE,
copy_lookup_para_file <- function(from_dir,
to_dir,
overwrite = FALSE,
recursive = TRUE,
file_pattern = "^lookup_para\\.csv$") {
from_dir <- normalizePath(from_dir)
Expand Down
2 changes: 1 addition & 1 deletion R/copy_xlsx_files.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' @param to_dir target directory where to copy the xlsx files
#' @param overwrite should existing files be overwritten (TRUE) otherwise (FALSE)
#' ? (default: FALSE)
#' @param recursive if TRUE recursively find all xlsx files in the directory
#' @param recursive if TRUE recursively find all xlsx files in the directory
#' specified in parameter "from_dir" (default: TRUE)
#' @param file_pattern pattern for identifying xlsx fles (default: "[xX][lL][sS][xX]")
#' @importFrom fs dir_create
Expand Down
14 changes: 7 additions & 7 deletions R/get_foerdermengen.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
#' @import dplyr
#' @export
get_foerdermengen <- function(xlsx_path,
sheet_name = "WW Q Rhow ",
sheet_name = "WW Q Rhow ",
sheet_range = "A4:S127") {

q_ww <- readxl::read_xlsx(
xlsx_path,
sheet = sheet_name,
range = sheet_range) %>%
xlsx_path,
sheet = sheet_name,
range = sheet_range
) %>%
dplyr::select(-dplyr::starts_with(".."))
q_ww <- q_ww %>%

q_ww <- q_ww %>%
tidyr::gather_(
key_col = "Wasserwerk",
value_col = "Foerdermenge_m3",
Expand Down
Loading

0 comments on commit 854d6fb

Please sign in to comment.