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

Optimization develop roxugen #411

Merged
merged 84 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
f5688c5
Merge pull request #380 from Olink-Proteomics/optimization_develop
klevdiamanti May 31, 2024
e1804a5
adding check_olinkid
MasoumehSheikhi Jun 11, 2024
ece9502
Document
MasoumehSheikhi Jun 11, 2024
aa30278
adding duplicate_sampleID and all_na_assays
MasoumehSheikhi Jul 3, 2024
fe1bbc7
Document
MasoumehSheikhi Jul 3, 2024
64d82be
check_npx function added and internal functions moved to same script
MasoumehSheikhi Jul 10, 2024
ad039dd
Document
MasoumehSheikhi Jul 10, 2024
8032af9
Add title on check_npx function
klevdiamanti Jul 17, 2024
92a951f
Update check_npx description
klevdiamanti Jul 17, 2024
69937e5
Update description of input variables in check_npx
klevdiamanti Jul 17, 2024
5565cf5
Reshape example from check_npx
klevdiamanti Jul 17, 2024
683b94b
Update names of variables returned by check_npx
klevdiamanti Jul 17, 2024
5e3d353
Reshape check_npx function
klevdiamanti Jul 17, 2024
61c2ab4
Modify check_npx_col_names title.
klevdiamanti Jul 17, 2024
594ce35
Update description of check_npx_col_names
klevdiamanti Jul 17, 2024
4b8e027
Update return of check_npx_col_names function
klevdiamanti Jul 17, 2024
cbb22eb
Change description of df input variable to check_npx based on check_n…
klevdiamanti Jul 17, 2024
c22525b
Add details about preferred_names to details of check_npx
klevdiamanti Jul 17, 2024
70240bc
Upgrade to RoxygenNote 7.3.2
klevdiamanti Jul 17, 2024
09e21c0
Update examples of check_npx_col_names
klevdiamanti Jul 17, 2024
c0f7f78
Bring examples from check_npx_col_names to check_npx
klevdiamanti Jul 17, 2024
650054a
Check if preferred_names is NULL in check_npx
klevdiamanti Jul 17, 2024
38ef6a4
check_npx_col_names add "wrap = FALSE" in cli::cli_abort
klevdiamanti Jul 17, 2024
872eaa0
No need to check preferred_names in check_npx
klevdiamanti Jul 17, 2024
8ab2386
Reshape check_npx_update_col_names
klevdiamanti Jul 17, 2024
202c143
check_npx_col_names and check_npx: switch from NPX_2 to PCNormalizedN…
klevdiamanti Jul 17, 2024
785084d
Update descriptions
klevdiamanti Jul 17, 2024
7145ec0
Allow R code snippets on RoxygenNote
klevdiamanti Jul 17, 2024
f1a26c1
Update documentation for check_npx-related functions
klevdiamanti Jul 17, 2024
a12877b
Update documentation for check_npx_olinkid
klevdiamanti Jul 17, 2024
16dabf8
Reshape check_npx_olinkid
klevdiamanti Jul 17, 2024
7270e1e
"wrap = FALSE" instead of "wrap = NULL"
klevdiamanti Jul 17, 2024
843d1f0
Fix some linting issues and update documentation for check_npx_all_na…
klevdiamanti Jul 17, 2024
4c304b5
Add some sections in functions check_npx_olinkid
klevdiamanti Jul 17, 2024
0536d29
Update documentation for check_npx_duplicate_sample_ids and check_npx…
klevdiamanti Jul 17, 2024
d15f7eb
Export check_npx
klevdiamanti Jul 17, 2024
e1f2042
Undo "Roxygen: list(markdown = TRUE)"
klevdiamanti Jul 17, 2024
2373dd3
Intrpduce "Roxygen: list(markdown = TRUE)"
klevdiamanti Jul 17, 2024
eee6eb8
Update check_is_boolean functions
klevdiamanti Jul 17, 2024
48d28a7
Minor update check_is_boolean
klevdiamanti Jul 17, 2024
179cf1f
Define default for error in check_is_boolean
klevdiamanti Jul 17, 2024
a2adbc6
Update documentation for check_is_character
klevdiamanti Jul 17, 2024
3bd61b5
Update check_columns
klevdiamanti Jul 17, 2024
cc28425
Update check_df
klevdiamanti Jul 17, 2024
4a117fd
Update check_file_exists
klevdiamanti Jul 17, 2024
5327117
Update check_file
klevdiamanti Jul 17, 2024
4eb473d
Update check_is_integer
klevdiamanti Jul 17, 2024
66f76f7
Minor documentation update
klevdiamanti Jul 17, 2024
b767c8c
Update check_library_installed
klevdiamanti Jul 17, 2024
1018145
Update check_list
klevdiamanti Jul 17, 2024
2b94d71
Rename check_library_installed
klevdiamanti Jul 17, 2024
20eeac0
Update check_is_numeric
klevdiamanti Jul 17, 2024
024a674
Update data
klevdiamanti Jul 17, 2024
a5e9109
Update utils
klevdiamanti Jul 17, 2024
4283963
Update read_npx
klevdiamanti Jul 17, 2024
ef02466
Update read_npx_delim
klevdiamanti Jul 17, 2024
18fbb1a
Update read_npx_excel
klevdiamanti Jul 17, 2024
5a82649
Bugfix read_npx_delim
klevdiamanti Jul 17, 2024
8cf4859
Update read_npx_format
klevdiamanti Jul 17, 2024
dc718fc
Minor updates read_npx
klevdiamanti Jul 17, 2024
ffef87c
Replace "call = NULL" with "call = rlang::caller_env()" in cli::cli_a…
klevdiamanti Jul 17, 2024
0a451c1
Update read_npx_legacy
klevdiamanti Jul 17, 2024
2918699
Update read_npx_format for bugs
klevdiamanti Jul 17, 2024
9da8734
Document
klevdiamanti Jul 17, 2024
bc255a2
Update read_npx_parquet
klevdiamanti Jul 18, 2024
8ad9a96
Update read_npx_utils
klevdiamanti Jul 18, 2024
3eef4b1
Update read_npx_wide
klevdiamanti Jul 18, 2024
1861eaa
Minor update read_npx_wide
klevdiamanti Jul 18, 2024
7f7fb79
Upodate read_npx_zip
klevdiamanti Jul 18, 2024
6f75109
Update check_npx_colnames
klevdiamanti Jul 18, 2024
c934c97
A
klevdiamanti Jul 18, 2024
22c6b73
Minor updates in documentation of all check_npx functions.
klevdiamanti Jul 18, 2024
c0e5320
Update check_npx error/warning messages
klevdiamanti Jul 18, 2024
70409b4
Add duckdb and dbplyr as suggested packages
klevdiamanti Jul 18, 2024
1289e51
Minor documentation update.
klevdiamanti Jul 18, 2024
f7f223c
Reshape tests and add one more for arrow input in all-NA assays
klevdiamanti Jul 18, 2024
e2e0893
Update read_npx documentation
klevdiamanti Jul 18, 2024
0432a41
Merge branch 'optimization_develop_roxugen' into opt_dev_checknpx_int…
klevdiamanti Jul 18, 2024
fca7688
Document
klevdiamanti Jul 18, 2024
7469c26
Merge pull request #412 from Olink-Proteomics/opt_dev_checknpx_intern…
klevdiamanti Jul 18, 2024
6eb6a3d
One skip_if_not_installed per package
klevdiamanti Jul 18, 2024
145b23d
Move dbplyr and duckdb to Imported packages
klevdiamanti Jul 18, 2024
bc2682c
Move readxl to Suggested packages
klevdiamanti Jul 18, 2024
07b5507
Fix NOTE from devtools::check for dbplyr and duckdb
klevdiamanti Jul 18, 2024
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
Binary file added .DS_Store
Binary file not shown.
5 changes: 4 additions & 1 deletion OlinkAnalyze/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,19 @@ Config/testthat/start-first: read_npx_l*, read_npx_w*
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.2
Roxygen: list(markdown = TRUE)
Depends: R (>= 4.1.0)
Imports:
arrow (>= 14.0.0),
cli (>= 3.6.1),
dbplyr,
dplyr,
readxl,
duckdb,
rlang,
stringr,
tidyr
Suggests:
readxl,
testthat (>= 3.0.0),
withr,
writexl,
Expand Down
3 changes: 3 additions & 0 deletions OlinkAnalyze/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(check_npx)
export(read_NPX)
export(read_npx)
importFrom(dbplyr,memdb_frame)
importFrom(duckdb,duckdb)
30 changes: 16 additions & 14 deletions OlinkAnalyze/R/check_boolean.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#' Help function checking if a variable is a boolean vector.
#'
#' @author Klev Diamanti
#' @author
#' Klev Diamanti
#'
#' @param bool Input to check.
#' @param error Boolean to return error or a boolean (default).
#' @param bool Boolean to check.
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return Boolean if the variable is a boolean vector or not, and an error if
#' `error = TRUE`.
#' "error = TRUE".
#'
#' @seealso
#' [check_is_character()]
#' [check_is_integer()]
#' [check_is_numeric()]
#' \code{\link{check_is_character}}
#' \code{\link{check_is_integer}}
#' \code{\link{check_is_numeric}}
#'
check_is_boolean <- function(bool,
error = FALSE) {
Expand Down Expand Up @@ -46,18 +47,19 @@ check_is_boolean <- function(bool,

#' Help function checking if a variable is a boolean vector of length 1.
#'
#' @author Klev Diamanti
#' @author
#' Klev Diamanti
#'
#' @param bool Input to check.
#' @param error Boolean to return error or a boolean (default).
#' @param bool Boolean vector to check.
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return Boolean if the variable is a boolean vector of length 1 or not, and
#' an error if `error = TRUE`.
#' an error if "error = TRUE".
#'
#' @seealso
#' [check_is_scalar_character()]
#' [check_is_scalar_integer()]
#' [check_is_scalar_numeric()]
#' \code{\link{check_is_scalar_character}}
#' \code{\link{check_is_scalar_integer}}
#' \code{\link{check_is_scalar_numeric}}
#'
check_is_scalar_boolean <- function(bool,
error = FALSE) {
Expand Down
30 changes: 16 additions & 14 deletions OlinkAnalyze/R/check_character.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#' Help function checking if a variable is a character vector.
#'
#' @author Klev Diamanti
#' @author
#' Klev Diamanti
#'
#' @param string Input to check.
#' @param error Boolean to return error or a boolean (default).
#' @param string String to check.
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return Boolean if the variable is a character vector or not, and an error if
#' `error = TRUE`.
#' "error = TRUE".
#'
#' @seealso
#' [check_is_boolean()]
#' [check_is_integer()]
#' [check_is_numeric()]
#' \code{\link{check_is_boolean}}
#' \code{\link{check_is_integer}}
#' \code{\link{check_is_numeric}}
#'
check_is_character <- function(string,
error = FALSE) {
Expand Down Expand Up @@ -50,18 +51,19 @@ check_is_character <- function(string,

#' Help function checking if a variable is a character vector of length 1.
#'
#' @author Klev Diamanti
#' @author
#' Klev Diamanti
#'
#' @param string Input to check.
#' @param error Boolean to return error or a boolean (default).
#' @param string String vector to check.
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return Boolean if the variable is a character vector of length 1 or not, and
#' an error if `error = TRUE`.
#' an error if "error = TRUE".
#'
#' @seealso
#' [check_is_scalar_boolean()]
#' [check_is_scalar_integer()]
#' [check_is_scalar_numeric()]
#' \code{\link{check_is_scalar_boolean}}
#' \code{\link{check_is_scalar_integer}}
#' \code{\link{check_is_scalar_numeric}}
#'
check_is_scalar_character <- function(string,
error = FALSE) {
Expand Down
10 changes: 6 additions & 4 deletions OlinkAnalyze/R/check_columns.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#' Check that an input tibble or arrow object contains the required columns.
#'
#' @description
#' `check_columns` checks if the input tibble or arrow object `data` contains
#' all of the columns in \var{col_list}.
#' Checks if the input tibble or arrow object \var{df} contains all of the
#' columns in \var{col_list}.
#'
#' @details
#' \var{col_list} might contain also vectors of characters as elements. In this
#' case one of the characters in the vector is expected to be present.
#' case one of the characters in the vector is expected to be present. See
#' examples.
#'
#' @author
#' Klev Diamanti
Expand Down Expand Up @@ -138,7 +140,7 @@ check_columns <- function(df,
one of the vectors of required columns: { missing_one }!",
"i" = "Please make sure they are part of the input dataset."
),
call = NULL,
call = rlang::caller_env(),
wrap = FALSE
)

Expand Down
15 changes: 6 additions & 9 deletions OlinkAnalyze/R/check_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
#' Klev Diamanti
#'
#' @param df Data frame to check.
#' @param error `TRUE` to return an error if \var{df} is not an arrow object;
#' `FALSE` (default) to return a boolean.
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return A scalar boolean if the object is an arrow object or not, and an
#' error if \var{error} = `TRUE`.
#' error if "error = TRUE".
#'
#' @seealso
#' \code{\link{check_is_tibble}}
Expand Down Expand Up @@ -55,11 +54,10 @@ check_is_arrow_object <- function(df,
#' Klev Diamanti
#'
#' @param df Data frame to check.
#' @param error `TRUE` to return an error if \var{df} is not a tibble; `FALSE`
#' (default) to return a boolean.
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return A scalar boolean if the object is a tibble or not, and an error if
#' \var{error} = `TRUE`.
#' "error = TRUE".
#'
#' @seealso
#' \code{\link{check_is_arrow_object}}
Expand Down Expand Up @@ -106,11 +104,10 @@ check_is_tibble <- function(df,
#' Klev Diamanti
#'
#' @param df Data frame to check.
#' @param error `TRUE` to return an error if \var{df} is not a tibble or an
#' arrow object; `FALSE` (default) to return a boolean.
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return A scalar boolean if the object is a tibble or an arrow object or not,
#' and an error if \var{error} = `TRUE`.
#' and an error if "error = TRUE".
#'
#' @seealso
#' \code{\link{check_is_arrow_object}}
Expand Down
27 changes: 17 additions & 10 deletions OlinkAnalyze/R/check_file_exists.R → OlinkAnalyze/R/check_file.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#' Help function checking if file exists.
#'
#' @author Klev Diamanti
#'
#' @param file Path to the file.
#' @param error Boolean to return error or a boolean (default).
#' @author
#' Klev Diamanti
#'
#' @description
#' Only one file at a time!
#' Check \strong{only one file at a time} if it exists.
#'
#' @param file Path to file.
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return Boolean if the file exists or not, and an error if `error = TRUE`.
#' @return Boolean if the file exists or not, and an error if "error = TRUE".
#'
check_file_exists <- function(file,
error = FALSE) {
Expand Down Expand Up @@ -51,14 +52,20 @@ check_file_exists <- function(file,

#' Help function checking if file extension is acceptable.
#'
#' @author Klev Diamanti
#' @author
#' Klev Diamanti
#'
#' @param file Path to the file.
#' @description
#' Use variable \var{accepted_npx_file_ext} to check if extension of the input
#' file is acceptable.
#'
#' @param file Path to file.
#'
#' @return The type of the file extension based on the global variable
#' `accepted_npx_file_ext`
#' \var{accepted_npx_file_ext}.
#'
check_file_extension <- function(file) {

# check input ----

check_is_scalar_character(string = file,
Expand All @@ -84,7 +91,7 @@ check_file_extension <- function(file) {
"x" = "Unable to recognize the extension of the file {.file {file}}!",
"i" = "Expected on of {.val {accepted_npx_file_ext}}!"
),
call = NULL,
call = rlang::caller_env(),
wrap = FALSE
)

Expand Down
30 changes: 16 additions & 14 deletions OlinkAnalyze/R/check_integer.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#' Help function checking if a variable is an integer vector.
#'
#' @author Klev Diamanti
#' @author
#' Klev Diamanti
#'
#' @param int Input to check.
#' @param error Boolean to return error or a boolean (default).
#' @param int Integer to check.
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return Boolean if the variable is an integer vector or not, and an error if
#' `error = TRUE`.or.
#' "error = TRUE".
#'
#' @seealso
#' [check_is_boolean()]
#' [check_is_character()]
#' [check_is_numeric()]
#' \code{\link{check_is_boolean}}
#' \code{\link{check_is_character}}
#' \code{\link{check_is_numeric}}
#'
check_is_integer <- function(int,
error = FALSE) {
Expand Down Expand Up @@ -50,18 +51,19 @@ check_is_integer <- function(int,

#' Help function checking if a variable is an integer vector of length 1.
#'
#' @author Klev Diamanti
#' @author
#' Klev Diamanti
#'
#' @param int Input to check.
#' @param error Boolean to return error or a boolean (default).
#' @param int Integer vector to check.
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return Boolean if the variable is an integer vector of length 1 or not, and
#' an error if `error = TRUE`.
#' an error if "error = TRUE".
#'
#' @seealso
#' [check_is_scalar_boolean()]
#' [check_is_scalar_character()]
#' [check_is_scalar_numeric()]
#' \code{\link{check_is_scalar_boolean}}
#' \code{\link{check_is_scalar_character}}
#' \code{\link{check_is_scalar_numeric}}
#'
check_is_scalar_integer <- function(int,
error = FALSE) {
Expand Down
7 changes: 4 additions & 3 deletions OlinkAnalyze/R/check_list.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#' Help function to check if the variable is a list.
#'
#' @author Klev Diamanti
#' @author
#' Klev Diamanti
#'
#' @param lst List to check.
#' @param error Boolean to return error or a boolean (default).
#' @param error Return error or a boolean (default = FALSE).
#'
#' @return Boolean if the object is a list or not, and an error if
#' `error = TRUE`.
#' "error = TRUE".
#'
check_is_list <- function(lst,
error = FALSE) {
Expand Down
Loading
Loading