Skip to content

Commit e0fb593

Browse files
author
dbolotov
committed
applied style
1 parent 0aeca52 commit e0fb593

File tree

105 files changed

+959
-922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+959
-922
lines changed

R/data_dictionary.R

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,13 @@
8686
if (field$class[[field$name[i]]] == "numeric") {
8787
optypelist[[fname]] <- "continuous"
8888
datypelist[[fname]] <- "double"
89-
}
90-
else if (field$class[[field$name[i]]] == "logical") {
89+
} else if (field$class[[field$name[i]]] == "logical") {
9190
optypelist[[fname]] <- "categorical"
9291
datypelist[[fname]] <- "boolean"
93-
}
94-
else if (field$class[[field$name[i]]] == "factor") {
92+
} else if (field$class[[field$name[i]]] == "factor") {
9593
optypelist[[fname]] <- "categorical"
9694
datypelist[[fname]] <- "string"
97-
}
98-
else {
95+
} else {
9996
disallowed_class <- field$class[[field$name[i]]]
10097
stop(paste(disallowed_class, "class is not supported for features. Supported classes: numeric, logical, factor."))
10198
}
@@ -112,8 +109,7 @@
112109
if (!(.removeAsFactor(field$name[i]) %in% namelist)) {
113110
namelist <- c(namelist, .removeAsFactor(field$name[i]))
114111
}
115-
}
116-
else {
112+
} else {
117113
ofnames <- strsplit(transformed$field_data[field$name[i], "orig_field_name"][[1]], ",")[[1]]
118114
for (j in 1:length(ofnames)) {
119115
ofname <- gsub("^\\s+|\\s+$", "", ofnames[j])
@@ -133,8 +129,7 @@
133129
}
134130
}
135131
}
136-
}
137-
else {
132+
} else {
138133
for (i in begin:number.of.fields) {
139134
fName <- field$name[i]
140135
if (length(grep("as\\.factor\\(", field$name[i])) == 1) {
@@ -277,8 +272,7 @@
277272
} else if (field$class[[field$name[i]]] == "logical") {
278273
optypelist[[field$name[i]]] <- "categorical"
279274
datypelist[[field$name[i]]] <- "boolean"
280-
}
281-
else if (field$class[[field$name[i]]] == "factor") {
275+
} else if (field$class[[field$name[i]]] == "factor") {
282276
optypelist[[field$name[i]]] <- "categorical"
283277
datypelist[[field$name[i]]] <- "string"
284278
}

R/make_intervals.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
make_intervals <- function(closure = NULL, leftMargin = NULL, rightMargin = NULL, namespace = "4_4") {
4949
namespace <- .getNamespace(namespace)
5050

51-
if ((length(closure) != length(leftMargin)) || (length(closure) != length(rightMargin))
52-
|| (length(leftMargin) != length(rightMargin))) {
51+
if ((length(closure) != length(leftMargin)) || (length(closure) != length(rightMargin)) ||
52+
(length(leftMargin) != length(rightMargin))) {
5353
stop("all parameters must have same length.")
5454
}
5555

R/make_values.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
#' @export
4747
make_values <- function(value = NULL, displayValue = NULL, property = NULL, namespace = "4_4") {
4848
namespace <- .getNamespace(namespace)
49-
if ((length(value) != length(displayValue)) || (length(value) != length(property))
50-
|| (length(displayValue) != length(property))) {
49+
if ((length(value) != length(displayValue)) || (length(value) != length(property)) ||
50+
(length(displayValue) != length(property))) {
5151
stop("all parameters must have same length.")
5252
}
5353

R/mining_schema.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,7 @@
333333
if (!(.removeAsFactor(field$name[i]) %in% namelist)) {
334334
namelist <- c(namelist, .removeAsFactor(field$name[i]))
335335
}
336-
}
337-
else {
336+
} else {
338337
ofnames <- strsplit(transformed$field_data[field$name[i], "orig_field_name"][[1]], ",")[[1]]
339338
for (j in 1:length(ofnames)) {
340339
ofname <- gsub("^\\s+|\\s+$", "", ofnames[j])

R/pmml.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ pmml <- function(model = NULL,
144144
} else {
145145
return(.pmmlLocalTransformations(field, transforms, NULL))
146146
}
147-
}
148-
else {
147+
} else {
149148
UseMethod("pmml")
150149
}
151150
}

R/pmml.ada.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pmml.ada <- function(model,
102102

103103
pmml <- append.XMLNode(pmml, .pmmlDataDictionary(noTargetFields, transformed = transforms))
104104

105-
#-------------------------------------------------------------
105+
#-------------------------------------------------------------
106106
# PMML -> MiningModel
107107

108108
# Even though ADA is a binary classifier, we set the functionName as regression here.

R/pmml.cv.glmnet.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,10 @@ pmml.cv.glmnet <- function(model,
222222

223223
# PMML -> Header
224224

225-
pmml <- append.XMLNode(pmml, .pmmlHeader(description, copyright, model_version,
226-
app_name))
225+
pmml <- append.XMLNode(pmml, .pmmlHeader(
226+
description, copyright, model_version,
227+
app_name
228+
))
227229

228230
# PMML -> DataDictionary
229231

R/pmml.gbm.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ pmml.gbm <- function(model,
122122

123123
# PMML -> Header
124124

125-
pmml <- append.XMLNode(pmml, .pmmlHeader(description, copyright, model_version,
126-
app_name))
125+
pmml <- append.XMLNode(pmml, .pmmlHeader(
126+
description, copyright, model_version,
127+
app_name
128+
))
127129

128130
# PMML -> DataDictionary
129131

@@ -455,8 +457,7 @@ pmml.gbm <- function(model,
455457
.makeNodes <- function(n, mod, tinf, fieldInfo) {
456458
if (n == 1) {
457459
return(append.XMLNode(xmlNode("Node", attrs = c(id = 1)), xmlNode("True")))
458-
}
459-
else {
460+
} else {
460461
side <- 6
461462
if (n %in% tinf[, 1]) {
462463
side <- 1

R/pmml.glm.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ pmml.glm <- function(model,
170170
if (model$call[[1]] == "glm") {
171171
model.type <- model$family$family
172172
model.link <- model$family$link
173-
}
174-
else {
173+
} else {
175174
model.type <- "unknown"
176175
}
177176

R/pmml.hclust.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ pmml.hclust <- function(model,
111111
#-------------------------------------------------------------------
112112
# PMML -> Header
113113

114-
pmml <- append.XMLNode(pmml, .pmmlHeader(description, copyright, model_version,
115-
app_name))
114+
pmml <- append.XMLNode(pmml, .pmmlHeader(
115+
description, copyright, model_version,
116+
app_name
117+
))
116118

117119
#-------------------------------------------------------------------
118120
# PMML -> DataDictionary

0 commit comments

Comments
 (0)