Skip to content

Commit

Permalink
help ColSeeker extended
Browse files Browse the repository at this point in the history
ksnormal returnes named numeric
  • Loading branch information
abusjahn committed Aug 1, 2024
1 parent d9d6b6f commit b2afe00
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
12 changes: 8 additions & 4 deletions R/basefunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ formatP <- function(pIn, ndigits = 3, textout = TRUE, pretext = FALSE,
#' FindVars(varnames = c("^c", "g"), allnames = colnames(mtcars), exclude = "r")
## rawdata <- mtcars
## FindVars(varnames = c("^c", "g"))

FindVars <- function(varnames, allnames = colnames(rawdata),
exact = FALSE, exclude = NA, casesensitive = TRUE,
fixed = FALSE, return_symbols=FALSE) {
Expand Down Expand Up @@ -270,7 +271,7 @@ FindVars <- function(varnames, allnames = colnames(rawdata),
}


#' Find numeric index and names of columns based on type and patterns
#' Find numeric index and names of columns based on class(es) and patterns
#'
#' \code{ColSeeker} looks up colnames (by default for tibble rawdata)
#' based on type and parts of names, using regular expressions.
Expand All @@ -286,12 +287,15 @@ FindVars <- function(varnames, allnames = colnames(rawdata),
#' @param returnclass Logical if classes should be included in output
#'
#' @export
#' @return A list with index, names, and backticked names, optionally the classes as well
#' @return A list with index, names, backticked names, and count; optionally the classes as well
#' @examples
#' ColSeeker(data = mtcars, namepattern = c("^c", "g"))
#' ColSeeker(data = mtcars, namepattern = c("^c", "g"), exclude = "r")
## rawdata <- mtcars
## ColSeeker(namepattern = c("^c", "g"), varclass="numeric")
#' assign("rawdata", mtcars)
#' ColSeeker(namepattern = c("^c", "g"), varclass="numeric")
#' num_int_data <- data.frame(num1=rnorm(10), num2=runif(10), int1=1:10, int2=11:20)
#' ColSeeker(num_int_data, varclass="numeric") # integers are not found
#' ColSeeker(num_int_data, varclass=c("numeric","integer"))
ColSeeker <- function(data=rawdata,
namepattern = '.',
varclass = NULL,
Expand Down
2 changes: 2 additions & 0 deletions R/tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,15 @@ ksnormal <- function(x, lillie=TRUE) {
if(lillie){
assign("ksout",
nortest::lillie.test(x)$p.value)
names(ksout) <- "p_Normal_Lilliefors"
} else{
suppressWarnings(
assign("ksout",
ks.test(x, "pnorm", mean(x, na.rm = TRUE),
sd(x, na.rm = TRUE),
exact = FALSE
)$p.value))
names(ksout) <- "p_Normal_KS"
}

}else{
Expand Down
9 changes: 7 additions & 2 deletions man/ColSeeker.Rd

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

0 comments on commit b2afe00

Please sign in to comment.