Skip to content

Commit 0b6ab1a

Browse files
committed
fix: restore numeric-vector-requires-y guard in cor/covDS
Server-side check preserves pre-refactor contract that was dropped when client-side validation moved to server. Redocument levelsDS.
1 parent 1ff323f commit 0b6ab1a

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

R/corDS.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ corDS <- function(x=NULL, y=NULL){
3838
else{
3939
y.val <- NULL
4040
}
41-
41+
42+
if (is.null(y.val) && any(class(x.val) %in% c("numeric", "integer"))) {
43+
stop("If x is a numeric vector, y must also be a numeric vector.", call. = FALSE)
44+
}
45+
4246
# create a data frame for the variables
4347
if (is.null(y.val)){
4448
dataframe <- as.data.frame(x.val)

R/covDS.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ covDS <- function(x=NULL, y=NULL, use=NULL){
4747
else{
4848
y.val <- NULL
4949
}
50-
50+
51+
if (is.null(y.val) && any(class(x.val) %in% c("numeric", "integer"))) {
52+
stop("If x is a numeric vector, y must also be a numeric vector.", call. = FALSE)
53+
}
54+
5155
# create a data frame for the variables
5256
if (is.null(y.val)){
5357
dataframe <- as.data.frame(x.val)

man/levelsDS.Rd

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)