similar to: rowsum() may return a vector instead of a matrix (PR#3737)

Displaying 20 results from an estimated 2000 matches similar to: "rowsum() may return a vector instead of a matrix (PR#3737)"

2003 Jul 11
1
Title obscured when using par(mfrow) (PR#3463)
I want to put multiple plots on a page using par(mfrow), then a single title at the top. This should work, but doesn't: R> par(oma=c(0,0,4,0), mfrow=c(3,4)) R> for (i in 1:12) {plot(1); title(i)} R> ## text(10,10, ".") R> par(mfrow=c(1,1), oma=c(0,0,1,0)) R> title("Main Title") The main title does not appear. However, uncommenting the third line
2001 Sep 14
1
rowsum dimnames (PR#1092)
The result of rowsum() in R doesn't have the dimnames I'd expect, e.g.: > rowsum(matrix(1:12, 3,4), c("Y","X","Y")) [,1] [,2] [,3] [,4] 1 2 5 8 11 2 4 10 16 22 whereas S-Plus gives the more useful result: [,1] [,2] [,3] [,4] X 2 5 8 11 Y 4 10 16 22 This is because R's rowsum() code gives the
2001 Sep 13
1
rowsum dimnames
Hi, The result of rowsum() in R doesn't have the dimnames I'd expect, e.g.: > rowsum(matrix(1:12, 3,4), c("Y","X","Y")) [,1] [,2] [,3] [,4] 1 2 5 8 11 2 4 10 16 22 whereas S-Plus gives the more useful result: [,1] [,2] [,3] [,4] X 2 5 8 11 Y 4 10 16 22 This is because R's rowsum() code gives
2003 Aug 15
2
Does order() behave differently on different platforms?
Hello, I am running R 1.7.1 on two platforms and it seems to me that order() behaves differently on them. I noticed this when a test case passed in linux but failed on solaris. This is the behavior on the solaris platform: R.Version() $platform [1] "sparc-sun-solaris2.8" $arch [1] "sparc" $os [1] "solaris2.8" $system [1] "sparc, solaris2.8" $status
2001 Dec 10
1
Documentation of .Last.lib in library() (PR#1209)
help(library) says: "`.Last.lib' is called when a package is loaded." Probably should be "...is detached." -- David Brahm (brahm@alum.mit.edu) --please do not edit the information below-- Version: platform = sparc-sun-solaris2.6 arch = sparc os = solaris2.6 system = sparc, solaris2.6 status = major = 1 minor = 3.1 year = 2001
2002 Aug 15
1
order(1, na.last=NA) fails (PR#1913)
R> order(1, na.last=NA) Error in apply(sapply(z, is.na), 1, any) : dim(X) must have a positive length This bug appears unrelated to PR#1906, and so the fix of 8/15 doesn't help. It comes from the line inside order(): ok <- !apply(sapply(z, is.na), 1, any) where z=list(1) in my example. sapply() returns a single-element vector, not a matrix, making apply() unhappy. This might
2010 Jan 15
1
How to calculate the row wise means for grouped columns in matrix?
Hi all, I want to calculate the row wise mean of groups of columns in a matrix M. All columns belonging to the same group have the same column name. My idea is to create a new vector V containing these column names, but after first removing the duplicates. Then I would calculate the means using for instance rowMean() and by comparing the column names of M with the vector V, getting the indices
2002 May 13
1
prettyNum inserts leading commas (PR#1548)
Under R-1.5.0 on Solaris 2.6: R> prettyNum(123456789, big.mark=",") [1] ",123,456,789" and that bad behavior (leading comma) spills into formatC as well: R> formatC(123456789, digits=0, format="f", big.mark=",") [1] ",123,456,789" Looks to me like a bug in src/library/base/R/format.R, in function prettyNum: B.[i.big] <-
2001 Oct 03
8
Several R vs S-Plus issues
Hi, all, I've been converting code from S-Plus ("S" for short) to R for a few weeks. Here are some differences I've found, aside from the big well-known ones (scoping, models, data storage) and the contents of Kurt Hornik's FAQ section 3.3.3. Let me start with the ones that seem like serious bugs or deficiencies: 1) LETTERS[c(NA,2)] in S is
2001 Oct 03
8
Several R vs S-Plus issues
Hi, all, I've been converting code from S-Plus ("S" for short) to R for a few weeks. Here are some differences I've found, aside from the big well-known ones (scoping, models, data storage) and the contents of Kurt Hornik's FAQ section 3.3.3. Let me start with the ones that seem like serious bugs or deficiencies: 1) LETTERS[c(NA,2)] in S is
2001 Oct 22
1
round() doesn't (PR#1139)
R> round(100000/3, -2) - 33300 [1] -7.275958e-12 I would have hoped for 0. The problem seems to be specifically for negative "digits". This is in 1.3.1 on Solaris 2.6 (full description at bottom). [Apologies for making everyone read this 3 times; my bug.report() burped.] Peter Dalgaard <p.dalgaard@biostat.ku.dk> says the problem is in fround.c, which reads in part:
2002 Aug 13
2
Misalignment of <NA> in rownames (PR#1905)
An NA in the rownames of a matrix (or dataframe) causes misalignment when the matrix is printed: R> x <- matrix(1:12, 3,4, dimnames=list(letters[1:3], LETTERS[1:4])) R> rownames(x)[2] <- NA R> x A B C D a 1 4 7 10 <NA> 2 5 8 11 c 3 6 9 12 The bug is in function Rstrlen, in src/main/printutils.c. MatrixRowLabel and MatrixColumnLabel (same file) rely on Rstrlen
2006 Jan 06
2
sudoku
Any doubts about R's big-league status should be put to rest, now that we have a Sudoku Puzzle Solver. Take that, SAS! See package "sudoku" on CRAN. The package could really use a puzzle generator -- contributors are welcome! -- David Brahm (brahm at alum.mit.edu) [[alternative HTML version deleted]] _______________________________________________ R-packages mailing list
2006 Jan 06
2
sudoku
Any doubts about R's big-league status should be put to rest, now that we have a Sudoku Puzzle Solver. Take that, SAS! See package "sudoku" on CRAN. The package could really use a puzzle generator -- contributors are welcome! -- David Brahm (brahm at alum.mit.edu) [[alternative HTML version deleted]] _______________________________________________ R-packages mailing list
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
2006 Apr 28
1
as.character.factor when the factor contains "NA"
as.character.factor contains this line (where cx=levels(x)[x]): if ("NA" %in% levels(x)) cx[is.na(x)] <- "<NA>" Is it possible that this is no longer the desired behavior? These two results don't seem very consistent: > as.character(as.factor(c("AB", "CD", NA))) [1] "AB" "CD" NA > is.na(.Last.value)[3] [1] TRUE
2005 Jul 06
2
Graphics: calling par(mar) after frame()
The following code produces 6 plots on a page, but the first is distorted and different from the others: par(mfrow=c(3,2), las=2) for (i in 1:6) { frame() par(mar=c(7, 7, 1, 1)) axis(2); box(); abline(h=seq(0,1,.5), col=2:4) } The first plot's axes are mis-aligned with the plotting area implied by the box. It seems to be a result of calling par(mar) after frame(). Is this expected
2002 Feb 20
1
Bug in "[<-.matrix"? (Was: Feature Request: "matrix[1:10,1:10, block=F] <- 1:10")
Thanks to David Meyer [david.meyer@ci.tuwien.ac.at] and David Brahm [brahm@alum.mit.edu] who suggested: m[ cbind(index.i, index.j) ] <- vals This works fine for the example I gave. Unfortunately, this approach doesn't extend to using the row and column names to make assignments: > m <- matrix("",ncol=3,nrow=3) > dimnames(m) <-
2004 Dec 22
2
outer(-x, x, pmin) cannot allocate
R> x <- 0. + 1:8000 R> y <- outer(-x, x, pmin) Error: cannot allocate vector of size 1000000 Kb Why does R need to allocate a gigabyte to create an 8000 x 8000 matrix? It doesn't have any trouble with outer(-x, x, "+"). Thanks. -- David Brahm (brahm at alum.mit.edu) Version: platform = i686-pc-linux-gnu arch = i686 os = linux-gnu system = i686, linux-gnu status =
2006 Aug 18
2
Floating point imprecision in sum() under R-2.3.1?
After upgrading to R-2.3.1 on Linux Redhat, I was suprised by this: R> x <- c(721.077, 592.291, 372.208, 381.182) R> sum(x) - 2066.758 [1] 4.547474e-13 Now I understand that floating point arithmetic is not precise, but 1) the result is exactly 0 in R-2.2.1 (patched) on the same machine, 2) .Machine$double.eps = 2.2e-16, so the error seems quite large. Also note I get the same