@@ -121,7 +121,7 @@ k_sample <- function(data, x, y,
121
121
} else {
122
122
paste(" Repeated measures ANOVA with" , sphericity , " correction" )
123
123
},
124
- alternative = as.character( NA ) ,
124
+ alternative = NA_character_ ,
125
125
estimate = es [[2L ]],
126
126
conf.level = es [[" CI" ]],
127
127
conf.low = es [[" CI_low" ]],
@@ -130,7 +130,13 @@ k_sample <- function(data, x, y,
130
130
n_obs = length(y_var ) / length(x_lvl )
131
131
)
132
132
133
- if (lbl ) return (lablr(test , markdown )) else return (test )
133
+ if (lbl ) {
134
+ test <- lablr(test , markdown )
135
+ }
136
+
137
+ class(test ) <- c(" writR" , " list" )
138
+
139
+ return (test )
134
140
} else {
135
141
136
142
test <- stats :: oneway.test(
@@ -148,7 +154,7 @@ k_sample <- function(data, x, y,
148
154
df.error = test $ parameter [[" denom df" ]],
149
155
p.value = test $ p.value ,
150
156
method = if (var.equal ) " Fisher's ANOVA" else " Welch's ANOVA" ,
151
- alternative = as.character( NA ) ,
157
+ alternative = NA_character_ ,
152
158
estimate = es [[1L ]],
153
159
conf.level = es [[" CI" ]],
154
160
conf.low = es [[" CI_low" ]],
@@ -157,7 +163,13 @@ k_sample <- function(data, x, y,
157
163
n_obs = length(y_var )
158
164
)
159
165
160
- if (lbl ) return (lablr(test , markdown )) else return (test )
166
+ if (lbl ) {
167
+ test <- lablr(test , markdown )
168
+ }
169
+
170
+ class(test ) <- c(" writR" , " list" )
171
+
172
+ return (test )
161
173
}
162
174
}
163
175
# Non-parametric statistics
@@ -183,10 +195,10 @@ k_sample <- function(data, x, y,
183
195
" x" = x ,
184
196
statistic = test $ statistic ,
185
197
df = as.double(test $ parameter ),
186
- df.error = as.double( NA ) ,
198
+ df.error = NA_real_ ,
187
199
p.value = test $ p.value ,
188
200
method = test $ method ,
189
- alternative = as.character( NA ) ,
201
+ alternative = NA_character_ ,
190
202
estimate = es [[1L ]],
191
203
conf.level = es [[" CI" ]],
192
204
conf.low = es [[" CI_low" ]],
@@ -195,7 +207,13 @@ k_sample <- function(data, x, y,
195
207
n_obs = length(y_var ) / length(x_lvl )
196
208
)
197
209
198
- if (lbl ) return (lablr(test , markdown )) else return (test )
210
+ if (lbl ) {
211
+ test <- lablr(test , markdown )
212
+ }
213
+
214
+ class(test ) <- c(" writR" , " list" )
215
+
216
+ return (test )
199
217
# Kruskal-Wallis rank-sum test for independent samples
200
218
} else {
201
219
test <- stats :: kruskal.test(
@@ -214,10 +232,10 @@ k_sample <- function(data, x, y,
214
232
" x" = x ,
215
233
statistic = test $ statistic ,
216
234
df = as.double(test $ parameter ),
217
- df.error = as.double( NA ) ,
235
+ df.error = NA_real_ ,
218
236
p.value = test $ p.value ,
219
237
method = test $ method ,
220
- alternative = as.character( NA ) ,
238
+ alternative = NA_character_ ,
221
239
estimate = es [[1L ]],
222
240
conf.level = es [[" CI" ]],
223
241
conf.low = es [[" CI_low" ]],
@@ -226,7 +244,13 @@ k_sample <- function(data, x, y,
226
244
n_obs = length(y_var )
227
245
)
228
246
229
- if (lbl ) return (lablr(test , markdown )) else return (test )
247
+ if (lbl ) {
248
+ test <- lablr(test , markdown )
249
+ }
250
+
251
+ class(test ) <- c(" writR" , " list" )
252
+
253
+ return (test )
230
254
}
231
255
}
232
256
# Robust statistics
@@ -258,7 +282,7 @@ k_sample <- function(data, x, y,
258
282
df.error = as.double(test $ df2 ),
259
283
p.value = test $ p.value ,
260
284
method = " one-way repeated measures ANOVA for trimmed means" ,
261
- alternative = as.character( NA ) ,
285
+ alternative = NA_character_ ,
262
286
estimate = es [[1L ]],
263
287
conf.level = 0.95 ,
264
288
conf.low = es [[2L ]],
@@ -267,7 +291,13 @@ k_sample <- function(data, x, y,
267
291
n_obs = length(y_var ) / length(x_lvl )
268
292
)
269
293
270
- if (lbl ) return (lablr(test , markdown )) else return (test )
294
+ if (lbl ) {
295
+ test <- lablr(test , markdown )
296
+ }
297
+
298
+ class(test ) <- c(" writR" , " list" )
299
+
300
+ return (test )
271
301
# one-way ANOVA for trimmed means
272
302
} else {
273
303
test <- WRS2 :: t1way(
@@ -284,7 +314,7 @@ k_sample <- function(data, x, y,
284
314
df.error = as.double(test $ df2 ),
285
315
p.value = test $ p.value ,
286
316
method = " one-way ANOVA for trimmed means" ,
287
- alternative = as.character( NA ) ,
317
+ alternative = NA_character_ ,
288
318
estimate = test $ effsize ,
289
319
conf.level = 0.95 ,
290
320
conf.low = test $ effsize_ci [[1L ]],
@@ -293,7 +323,13 @@ k_sample <- function(data, x, y,
293
323
n_obs = length(y_var )
294
324
)
295
325
296
- if (lbl ) return (lablr(test , markdown )) else return (test )
326
+ if (lbl ) {
327
+ test <- lablr(test , markdown )
328
+ }
329
+
330
+ class(test ) <- c(" writR" , " list" )
331
+
332
+ return (test )
297
333
}
298
334
}
299
335
}
0 commit comments