Skip to content

Commit

Permalink
#164 - Changes due to devtools::check() and devtools::document().
Browse files Browse the repository at this point in the history
  • Loading branch information
sophie-gem committed Feb 18, 2024
1 parent 4d7e1b7 commit 8a46862
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 24 deletions.
30 changes: 15 additions & 15 deletions R/format.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,18 +229,18 @@ xportr_format <- function(.df,
# character variable formats should start with a $
if (grepl("^\\$", format_sas) == FALSE) {
message <- glue(
"(xportr::xportr_format)
{encode_vars(colnames(.df)[i])} is a character variable and
should have a `$` prefix."
"(xportr::xportr_format)",
" {encode_vars(colnames(.df)[i])} is a character variable",
" and should have a `$` prefix."
)
xportr_logger(message, type = "warn")
}
# character variable formats should have length <= 31 (excluding the $)
if (nchar(gsub(".$", "", format_sas)) > 32) {
message <- glue(
"(xportr::xportr_format)
Format for character variable {encode_vars(colnames(.df)[i])}
should have length <= 31 (excluding `$`)."
"(xportr::xportr_format)",
" Format for character variable {encode_vars(colnames(.df)[i])}",
" should have length <= 31 (excluding `$`)."
)
xportr_logger(message, type = "warn")
}
Expand All @@ -251,18 +251,18 @@ xportr_format <- function(.df,
# numeric variables should not start with a $
if (grepl("^\\$", format_sas) == TRUE) {
message <- glue(
"(xportr::xportr_format)
{encode_vars(colnames(.df)[i])} is a numeric variable
and should not have a `$` prefix."
"(xportr::xportr_format)",
" {encode_vars(colnames(.df)[i])} is a numeric variable and",
" should not have a `$` prefix."
)
xportr_logger(message, type = "warn")
}
# numeric variable formats should have length <= 32
if (nchar(gsub(".$", "", format_sas)) > 32) {
message <- glue(
"(xportr::xportr_format)
Format for numeric variable {encode_vars(colnames(.df)[i])}
should have length <= 32."
"(xportr::xportr_format)",
" Format for numeric variable {encode_vars(colnames(.df)[i])}",
" should have length <= 32."
)
xportr_logger(message, type = "warn")
}
Expand All @@ -273,9 +273,9 @@ xportr_format <- function(.df,
!(format_sas %in% toupper(expected_formats)) &&
(stringr::str_detect(format_sas, pattern = format_regex) == FALSE)) {
message <- glue(
"(xportr::xportr_format)
Check format {encode_vars(format_sas)} for variable {encode_vars(colnames(.df)[i])}
- is this correct?"
"(xportr::xportr_format)",
" Check format {encode_vars(format_sas)} for variable {encode_vars(colnames(.df)[i])}",
" - is this correct?"
)
xportr_logger(message, type = "message")
}
Expand Down
2 changes: 1 addition & 1 deletion man/metadata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/xportr-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/xportr_df_label.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 58 additions & 1 deletion man/xportr_format.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/xportr_label.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/xportr_length.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/xportr_order.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/xportr_type.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/xportr_write.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8a46862

Please sign in to comment.