similar to: No [[<-.factor()

Displaying 20 results from an estimated 20000 matches similar to: "No [[<-.factor()"

2009 Apr 13
1
should sub(perl=TRUE) also handle \E in replacement, to complement \U and \L?
Currently sub(perl=TRUE) allows you to specify \U and \L in the replacement argument so that the rest of the subpatterns in the line (the \\<digit> things) will be converted to upper or lower case, respectively. perl also also has a \E operator to end these case conversions for the rest of the subpatterns (so they retain whatever case they had in the original text). For symmetry's sake
2010 Nov 29
2
FW: how to use by() ?
Thank you for the suggestion, Bill. The result is not quite what I would like. Here's sample code for you or anyone else who may be interested: Al1 = c('A','C','C','C') Al2 = c('G','G','G','T') Freq1 = c(0.0078,0.0567,0.9434,0.9908) MAF = c(0.0078,0.0567,0.0566,0.0092) m1 = data.frame(Al1=Al1,
2011 Apr 11
3
sort.int(S3object) strips class but not the is.object flag
If x has an S3 class then sort.int(x) returns a value without an S3 class but which has the is.object flag set, which, I think, causes identical() give a false/misleading report: > x <- structure(1:3, class="unrecognizedClass") > y <- sort.int(x) > t <- 1:3 > identical(y, t) # expect TRUE [1] FALSE > identical(as.vector(y), as.vector(t)) # expect
2008 Oct 03
3
Can DESCRIPTION Maintainer: field contain general URL instead of only email address?
Our firm would like to route support requests through a website instead of using email. However R will refuse to install a package if DESCRIPTION's Maintainer field does not have a valid email adress or the special value "ORPHANED". (The check is done with tools:::.valid_maintainer_field_regexp.) I imagine a typical Maintainer line for the package "foo" might be
2011 Mar 25
2
two minor bugs in rowsum()
(a) In R 2.12.2 rowsum can overflow if given an integer input: > rowsum(c(2e9L, 2e9L), c("a", "a")) [,1] a -294967296 > 2^32 + .Last.value [,1] a 4e+09 Should it be changed to coerce its x argument to numeric (double precision) so it always returns a numeric output? (b) When rowsum is given an x containing both NaN and NA it appears to use the last
2011 Sep 23
1
should dir(all=TRUE) return "." and ".."?
dir(all=TRUE) returns the file names "." and ".." while dir(recursive=TRUE, all=TRUE, include.dirs=TRUE) does not. I always filter out the "." and ".." entries and was wondering if anyone would mind if dir(all=TRUE) just omitted them? It might make recursive file operations like cleaning out a directory safer, as unlink(recursive=TRUE, dir(all=TRUE,
2012 Oct 11
1
simplify2array edge case
Should simplify2array(higher=TRUE) treat 1 by 1 matrices differently than others? I expected a 3-dimensional array from all of the following 3 examples, not just the last 2. > str(simplify2array(list(array(11,c(1,1)), array(21,c(1,1))), higher=TRUE)) num [1:2] 11 21 > str(simplify2array(list(array(11:13,c(3,1)), array(21:23,c(3,1))), higher=TRUE)) int [1:3, 1, 1:2] 11 12 13 21 22
2009 Sep 18
1
what should names(x) be padded with when length(x) is increased?
R version 2.10.0 Under development (unstable) (2009-09-08 r49628) Here are two somewhat related questions. First, when we attach a too short names vector to a vector the names vector is padded with NA's to the length of the main vector: E.g., > x<-1:3 > names(x)<-c("One","Two") > str(x) Named int [1:3] 1 2 3 - attr(*, "names")=
2011 Feb 07
2
as.list(subclassed function) -> cannot coerce type 'closure' to vector of type 'list'
I was looking for all the glm-related 'family' functions in stats using the following predicate that returns TRUE for any function whose first argument is called "link". is.family <- function(object) is.function(object) && identical(names(as.list(object))[1], "link") It threw an error when applied to SSfol > is.family(SSfol) Error in
2009 Oct 22
1
Error in link in Rd file stops package installation
With a pretty recent version of R 2.11.0 (devel,unstable, svn 50178) on Linux I could not install version 1.5-8 of zoo (the current on on CRAN): % R-devel CMD INSTALL -l Rlib3 zoo * installing *source* package 'zoo' ... ** R ** inst ** preparing package for lazy loading ** help *** installing help indices converting help for package 'zoo' finding
2013 Nov 07
1
R interface to C API Rf_logspace_{add,sub}?
Is there an R-language interface to the R API C-language functions Rf_logspace_add() and Rf_logspace_sub()? I don't see one but I may not looking under the right name. Various packages have functions which do that same sort of thing (log(exp(x)+exp(y)) and log(exp(x)-exp(y)) without unnecessary floating point errors). They have names like matrixStats::logSumExp(lx, na.rm=FALSE, ...)
2013 Jun 25
1
F statistic in add1.lm vs add1.glm
Should the F statistic be the same when using add1() on models created by lm and glm(family=gaussian)? They are in the single-degree-of-freedom case but not in the multiple-degree-of-freedom case. MASS:addterm shows the same discrepancy. It looks like the deviance (==residual sum of squares) gets divided by the number of degrees of freedom for the term twice in add1.glm. Using anova() on the
2008 Oct 30
1
row.names(data.frame(matrixWithDimnames)) depends on first rowname being "" or not. (PR#13230)
Full_Name: Bill Dunlap Version: R version 2.9.0 Under development (unstable) (2008-10-29 r46795) OS: Linux Submission from: (NULL) (76.28.245.14) When data.frame() is given a matrix with rownames, then the type of the output row names depends on whether the first element of the input row names is "" or not. The other elements of the input row names don't affect things. E.g.,
2009 May 08
1
anyDuplicated(incomp=NA) fails
With today's R 2.10.0(devel) I get: > anyDuplicated(c(1,NA,3,NA,5), incomp=NA) # expect 0 Warning: stack imbalance in 'anyDuplicated', 20 then 21 Warning: stack imbalance in '.Internal', 19 then 20 Warning: stack imbalance in '{', 17 then 18 [1] 0 > anyDuplicated(c(1,NA,3,NA,3), incomp=NA) # expect 5 Warning: stack imbalance in 'anyDuplicated', 20 then 21
2009 Apr 30
2
NA_real_ <op> NaN -> NA or NaN, should we care?
On Linux when I compile R 2.10.0(devel) (src/main/arithmetic.c in particular) with gcc 3.4.5 using the flags -g -O2 I get noncommutative behavior when adding NA and NaN: > NA_real_ + NaN [1] NaN > NaN + NA_real_ [1] NA If I compile src/main/arithmetic.c without optimization (just -g) then both of those return NA. On Windows, using a precompiled R 2.8.1 from CRAN I get NA for
2011 Jan 19
1
buglet in weighted.residuals(mlmObject)
When weighted.residuals() is given a fitted model object with several responses (class mlm) and some zero weights it returns a vector instead of a matrix. It looks like it is doing resids[ weights != 0 ] instead of resids[ weights != 0, , drop=FALSE] in the multi-response case. E.g., > d4 <- data.frame(y1=1:4, y2=2^(0:3), wt=log(1:4), fac=LETTERS[c(1,1,2,2)]) > fit <-
2011 Sep 01
1
"\088" is legal syntax?
Is it intentional that the digit 8 is allowed in octal escape sequences in character literals? > "\110" == "\088" [1] TRUE > "\8" == "\b" [1] TRUE 9's are rejected, so I'd expected 8's to be illegal as well. > "\9" Error: '\9' is an unrecognized escape in character string starting "\9" >
2010 Mar 12
1
problem with parse(text=quote(name))
Calling parse(text=quote(name)) or text=as.name("name") makes parse() prompt for input from the command line and then it returns a parse of the initial characters of 'name' (depending on how many characters were typed at the prompt). E.g., > parse(text=quote(myName)) ?1/3 expression(myN) attr(,"srcfile") <text> >
2010 Mar 10
1
log2(quote(1:10)) evaluates the quoted 1:10, log() does not
This is very minor, but shouldn't log2(quote(1:10)) throw an error,the same as log() and other math functions do? It looks like log2 and log10 evaluate a call object instead of throwing a non-numeric-argument error. They do object to non-call language objects, like expressions. > log2(quote(1:10)) [1] 0.000000 1.000000 1.584963 2.000000 2.321928 2.584963 [7] 2.807355 3.000000
2012 Dec 06
1
svd(X, LINPACK=TRUE) alters its input
Ordinary functions should not alter their inputs but in R-2.15.2 svd(LINPACK=TRUE,X) does. (It worked in 2.15.0 but not in 2.15.1 or 2.15.2 and became deprecated in 2.15.2.) > X <- matrix(c(1,2,3, 5,7,11, 13,17,19), 3, 3) > X [,1] [,2] [,3] [1,] 1 5 13 [2,] 2 7 17 [3,] 3 11 19 > svd(X, LINPACK=TRUE)$d [1] 31.9718214 2.3882717 0.3143114 Warning message: