Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
e8257ab9
Commit
e8257ab9
authored
7 years ago
by
Tomas Stupka
Browse files
Options
Downloads
Patches
Plain Diff
use an equivalent of the Rf_isVector C function instead of is.vector which works differently
parent
a6ebe1e3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/model.R
+12
-6
12 additions, 6 deletions
....r.library/src/com/oracle/truffle/r/library/stats/model.R
with
12 additions
and
6 deletions
com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/model.R
+
12
−
6
View file @
e8257ab9
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
# The structure of the implementation somewhat reflects GnuR so that
# The structure of the implementation somewhat reflects GnuR so that
# it is easier to update this code, should the code in GnuR be changed.
# it is easier to update this code, should the code in GnuR be changed.
#
#
# Please run tests in modelTests.R when updating this file!
# Please run
in GnuR the
tests in modelTests.R when updating this file!
#
#
# ================================================================
# ================================================================
...
@@ -35,9 +35,15 @@ isLanguage <- function(x) {
...
@@ -35,9 +35,15 @@ isLanguage <- function(x) {
is.null
(
x
)
||
typeof
(
x
)
==
"language"
is.null
(
x
)
||
typeof
(
x
)
==
"language"
}
}
# as in Rf_isVector which works differently to is.vector
isVector
<-
function
(
x
)
{
typeof
(
x
)
%in%
c
(
"logical"
,
"integer"
,
"numeric"
,
"double"
,
"complex"
,
"character"
,
"raw"
,
"expression"
)
}
nrows
<-
function
(
x
)
{
nrows
<-
function
(
x
)
{
plain
<-
unclass
(
x
)
# this is necessary because of 'AsIs' class: e.g. I(var+4)
plain
<-
unclass
(
x
)
# this is necessary because of 'AsIs' class: e.g. I(var+4)
if
(
is.factor
(
x
)
||
is
.v
ector
(
plain
)
||
is.list
(
plain
)
||
is.matrix
(
plain
)
)
{
if
(
is.factor
(
x
)
||
is
V
ector
(
plain
)
||
is.list
(
plain
))
{
dims
<-
dim
(
plain
);
dims
<-
dim
(
plain
);
if
(
is.null
(
dims
))
{
if
(
is.null
(
dims
))
{
return
(
length
(
plain
))
return
(
length
(
plain
))
...
@@ -51,7 +57,7 @@ nrows <- function(x) {
...
@@ -51,7 +57,7 @@ nrows <- function(x) {
ncols
<-
function
(
x
)
{
ncols
<-
function
(
x
)
{
plain
<-
unclass
(
x
)
plain
<-
unclass
(
x
)
if
(
is.factor
(
x
)
||
is
.v
ector
(
plain
)
||
is.list
(
plain
)
||
is.matrix
(
plain
)
)
{
if
(
is.factor
(
x
)
||
is
V
ector
(
plain
)
||
is.list
(
plain
))
{
dims
<-
dim
(
plain
);
dims
<-
dim
(
plain
);
if
(
is.null
(
dims
))
{
if
(
is.null
(
dims
))
{
return
(
1L
);
return
(
1L
);
...
@@ -88,7 +94,7 @@ isZeroOne <- function(x) {
...
@@ -88,7 +94,7 @@ isZeroOne <- function(x) {
}
}
MatchVar
<-
function
(
var1
,
var2
)
{
MatchVar
<-
function
(
var1
,
var2
)
{
if
(
is
.v
ector
(
var1
)
&&
is
.v
ector
(
var2
)
&&
var1
==
var2
)
{
if
(
is
V
ector
(
var1
)
&&
is
V
ector
(
var2
)
&&
var1
==
var2
)
{
return
(
TRUE
)
return
(
TRUE
)
}
else
if
(
is.null
(
var1
)
&&
is.null
(
var2
))
{
}
else
if
(
is.null
(
var1
)
&&
is.null
(
var2
))
{
return
(
TRUE
)
return
(
TRUE
)
...
@@ -783,7 +789,7 @@ modelframe <- function(formula, rownames, variables, varnames, dots, dotnames, s
...
@@ -783,7 +789,7 @@ modelframe <- function(formula, rownames, variables, varnames, dots, dotnames, s
data
<-
variables
data
<-
variables
dataNames
<-
varnames
dataNames
<-
varnames
}
}
names
(
data
)
<-
dataNames
names
(
data
)
<-
dataNames
# Note, the following steps up to running na.action could be simplified to:
# Note, the following steps up to running na.action could be simplified to:
...
...
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