Skip to content

Commit

Permalink
Use methods::is instead of class
Browse files Browse the repository at this point in the history
  • Loading branch information
jlmelville committed Dec 4, 2019
1 parent ea4363e commit b5ce375
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions R/gradient.R
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ newton_direction <- function(try_safe_chol = FALSE) {
},
silent = TRUE
)
if (class(chol_result) == "try-error") {
if (methods::is(chol_result, "try-error")) {
rm <- NULL
}
}
Expand Down Expand Up @@ -857,7 +857,7 @@ safe_chol <- function(hm, eps = 1e-10) {
},
silent = TRUE
)
if (class(chol_result) == "try-error") {
if (methods::is(chol_result, "try-error")) {

# Also O(N^3)
eig <- eigen(hm)
Expand Down
2 changes: 1 addition & 1 deletion R/schmidt.R
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ polyfit <- function(points) {
}
# Find interpolating polynomial
params <- try(solve(A, b), silent = TRUE)
if (class(params) == "numeric") {
if (methods::is(params, "numeric")) {
params <- rev(params)
}
else {
Expand Down
2 changes: 1 addition & 1 deletion vignettes/mmds.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ will plot the `par` results:

```{r plot results, fig.width=5.5, fig.height=5.5}
plot_mmds <- function(coords, dist, ...) {
if (class(coords) == "numeric") {
if (methods::is(coords, "numeric")) {
coords <- matrix(coords, ncol = 2, byrow = TRUE)
}
graphics::plot(coords, type = 'n')
Expand Down

0 comments on commit b5ce375

Please sign in to comment.