Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
2701 views
1
;;;; Things that go wrong or *went* wrong in the past
2
;;;; (from list side) see R-ESS-bugs.R for the R's side.
3
4
5
;;;; 1 ess-get-words-from-vector stumbles over \"
6
(ess-get-words-from-vector "c('aaa','bbb\"ccc', 'dddd')\n")
7
;;-> (" " "ccc" "dddd"): SOLVED
8
9
10
;;;; 2 ess-get-words-from-vector disregards max.print
11
;; options(max.print=1000) (warning added to the docs)
12
(length (ess-get-words-from-vector "as.character(1:10000)\n"))
13
;;-> 1001 with "max.print" at the end; added a comment in the function doc
14
15
;;;; 3 Inferior-ess-primary-prompt does not capture "+ + > "
16
;; this hangs emacs; SOLVED
17
(ess-command "tf<-function(N){
18
N}\n")
19
20
;;;; 4 ess-command detects the prompt prematurely
21
;; this outputs str(iris) in the inferior buffer; SOLVED
22
(ess-command "
23
lm_test <- function (formula, data, subset, weights, na.action, method = 'qr',
24
model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE,
25
contrasts = NULL, offset, ...)
26
{
27
cl <- match.call()
28
mf <- match.call(expand.dots = FALSE)
29
m <- match(c('formula', 'data', 'subset', 'weights', 'na.action',
30
'offset'), names(mf), 0L)
31
mf <- mf[c(1L, m)]
32
mf$drop.unused.levels <- TRUE
33
mf[[1L]] <- as.name('model.frame')
34
mf <- eval(mf, parent.frame())
35
if (method == 'model.frame')
36
return(mf)
37
else if (method != 'qr')
38
warning(gettextf('method is not supported. Using',
39
method), domain = NA)
40
mt <- attr(mf, 'terms')
41
y <- model.response(mf, 'numeric')
42
w <- as.vector(model.weights(mf))
43
if (!is.null(w) && !is.numeric(w))
44
stop('weights must be a numeric vector')
45
offset <- as.vector(model.offset(mf))
46
if (!is.null(offset)) {
47
if (length(offset) != NROW(y))
48
stop(gettextf('number of offsets is %d, should equal %d (number of observations)',
49
length(offset), NROW(y)), domain = NA)
50
}
51
if (is.empty.model(mt)) {
52
x <- NULL
53
z <- list(coefficients = if (is.matrix(y)) matrix(, 0,
54
3) else numeric(0L), residuals = y, fitted.values = 0 *
55
y, weights = w, rank = 0L, df.residual = if (!is.null(w)) sum(w !=
56
0) else if (is.matrix(y)) nrow(y) else length(y))
57
if (!is.null(offset)) {
58
z$fitted.values <- offset
59
z$residuals <- y - offset
60
}
61
}
62
else {
63
x <- model.matrix(mt, mf, contrasts)
64
z <- if (is.null(w))
65
lm.fit(x, y, offset = offset, singular.ok = singular.ok,
66
...)
67
else lm.wfit(x, y, w, offset = offset, singular.ok = singular.ok,
68
...)
69
}
70
class(z) <- c(if (is.matrix(y)) 'mlm', 'lm')
71
z$na.action <- attr(mf, 'na.action')
72
z$offset <- offset
73
z$contrasts <- attr(x, 'contrasts')
74
z$xlevels <- .getXlevels(mt, mf)
75
z$call <- cl
76
z$terms <- mt
77
if (model)
78
z$model <- mf
79
if (ret.x)
80
z$x <- x
81
if (ret.y)
82
z$y <- y
83
if (!qr)
84
z$qr <- NULL
85
z
86
}
87
str(iris)
88
")
89
90
;;;; 5 double prompt > > used to stall emacs; SOLVED
91
(ess-command "\n\n\n")
92
93