Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RFSurrogates
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AG Seifert
RFSurrogates
Commits
105a670c
Verified
Commit
105a670c
authored
1 year ago
by
Gärber, Florian
Browse files
Options
Downloads
Patches
Plain Diff
fix: Using if() conditions comparing class() to string
Now using inherits()
parent
6c3ad33e
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
R/var.relations.R
+1
-1
1 addition, 1 deletion
R/var.relations.R
R/var.relations.mfi.R
+1
-1
1 addition, 1 deletion
R/var.relations.mfi.R
R/variable_selection_mir.R
+1
-1
1 addition, 1 deletion
R/variable_selection_mir.R
R/variable_selection_smd.R
+1
-1
1 addition, 1 deletion
R/variable_selection_smd.R
with
4 additions
and
4 deletions
R/var.relations.R
+
1
−
1
View file @
105a670c
...
@@ -91,7 +91,7 @@ var.relations = function(x = NULL, y = NULL, num.trees = 500, type = "regression
...
@@ -91,7 +91,7 @@ var.relations = function(x = NULL, y = NULL, num.trees = 500, type = "regression
stop
(
"Too much classes defined, classification might be the wrong choice"
)
stop
(
"Too much classes defined, classification might be the wrong choice"
)
}
}
}
}
if
(
type
==
"regression"
&&
class
(
y
)
==
"factor"
)
{
if
(
type
==
"regression"
&&
inherits
(
y
,
"factor"
)
)
{
stop
(
"use factor variable for y only for classification! "
)
stop
(
"use factor variable for y only for classification! "
)
}
}
...
...
This diff is collapsed.
Click to expand it.
R/var.relations.mfi.R
+
1
−
1
View file @
105a670c
...
@@ -93,7 +93,7 @@ var.relations.mfi = function(x = NULL, y = NULL, num.trees = 500, type = "regres
...
@@ -93,7 +93,7 @@ var.relations.mfi = function(x = NULL, y = NULL, num.trees = 500, type = "regres
stop
(
"Too much classes defined, classification might be the wrong choice"
)
stop
(
"Too much classes defined, classification might be the wrong choice"
)
}
}
}
}
if
(
type
==
"regression"
&&
class
(
y
)
==
"factor"
)
{
if
(
type
==
"regression"
&&
inherits
(
y
,
"factor"
)
)
{
stop
(
"use factor variable for y only for classification! "
)
stop
(
"use factor variable for y only for classification! "
)
}
}
...
...
This diff is collapsed.
Click to expand it.
R/variable_selection_mir.R
+
1
−
1
View file @
105a670c
...
@@ -110,7 +110,7 @@ var.select.mir = function(x = NULL, y = NULL, num.trees = 500, type = "regressio
...
@@ -110,7 +110,7 @@ var.select.mir = function(x = NULL, y = NULL, num.trees = 500, type = "regressio
stop
(
"Too much classes defined, classification might be the wrong choice"
)
stop
(
"Too much classes defined, classification might be the wrong choice"
)
}
}
}
}
if
(
type
==
"regression"
&&
class
(
y
)
==
"factor"
)
{
if
(
type
==
"regression"
&&
inherits
(
y
,
"factor"
)
)
{
stop
(
"use factor variable for y only for classification! "
)
stop
(
"use factor variable for y only for classification! "
)
}
}
...
...
This diff is collapsed.
Click to expand it.
R/variable_selection_smd.R
+
1
−
1
View file @
105a670c
...
@@ -112,7 +112,7 @@ var.select.smd = function(x = NULL, y = NULL, num.trees = 500, type = "regressio
...
@@ -112,7 +112,7 @@ var.select.smd = function(x = NULL, y = NULL, num.trees = 500, type = "regressio
stop
(
"Too much classes defined, classification might be the wrong choice"
)
stop
(
"Too much classes defined, classification might be the wrong choice"
)
}
}
}
}
if
(
type
==
"regression"
&&
class
(
y
)
==
"factor"
)
{
if
(
type
==
"regression"
&&
inherits
(
y
,
"factor"
)
)
{
stop
(
"use factor variable for y only for classification! "
)
stop
(
"use factor variable for y only for classification! "
)
}
}
data
=
data.frame
(
y
,
x
)
data
=
data.frame
(
y
,
x
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment