similar to: Setting matrix dimnames in a list

Displaying 20 results from an estimated 20000 matches similar to: "Setting matrix dimnames in a list"

2005 Oct 19
3
diag() problem
Hi I have a matrix "u", for which diag() gives an error: u <- structure(c(5.42334674128216, -2.31319389204264, -5.83059042218476, -1.64112369640695, -2.31319389212801, 3.22737617646609, 1.85200668021569, -0.57102273078531, -5.83059042231881, 1.85200668008156, 11.9488923894962, -3.5525537165941, -1.64112369587405, -0.571022730886046, -3.55255371755604,
2015 May 13
1
Why is the diag function so slow (for extraction)?
As kindly pointed out to me (oh my decaying gray matter), is.object() is better suited for this test; $ svn diff src/library/base/R/diag.R Index: src/library/base/R/diag.R =================================================================== --- src/library/base/R/diag.R (revision 68345) +++ src/library/base/R/diag.R (working copy) @@ -23,9 +23,11 @@ stop("'nrow' or
2015 May 12
2
Why is the diag function so slow (for extraction)?
>>>>> Steve Bronder <sbronder at stevebronder.com> >>>>> on Thu, 7 May 2015 11:49:49 -0400 writes: > Is it possible to replace c() with .subset()? It would be possible, but I think "entirely" wrong. .subset() is documented to be an internal function not to be used "lightly" and more to the point it is documented to *NOT*
2015 May 05
3
Why is the diag function so slow (for extraction)?
Looks like the c(x)[...] bit used to be as.matrix(x)[...]. Not sure why the change was made many years ago, but this was before names were handled explicitly. It would definitely be better to not force the duplicate, at least in the case where we are sure c() and [ would not dispatch. Best, luke On Mon, 4 May 2015, peter dalgaard wrote: > >> On 04 May 2015, at 19:59 , franknarf
1999 Aug 18
2
diag()
I would like to suggest a slight modification to diag(). In the case where x is a matrix with both row names and column names the same, it would be reasonable if the resulting vector also had those names. I often use diag() on variance matrices, where this modification is helpful. The modification requires replacing if (is.matrix(x) && nargs() == 1) return(c(x)[1 +
2011 Feb 07
3
Giving vector of colors to line in plots
Hey all, I can't for the life of me figure out what I'm missing here. I'm trying to change the color of the line in a time series type plot. I can change the point colors and symbols no problem, but for some reason the colors do not get passed to the lines, regardless of if I do type="b" or type="l". The sample code I'm using is below. Any help would be
2007 Mar 20
1
Error in nlme with factors in R 2.4.1
Hi, the following R lines work fine in R 2.4.0, but not in R 2.4.1 or any devel versions of R 2.5.0 (see below for details). library(drc) # to load the dataset 'PestSci' library(nlme) ## Setting starting values sv <- c(0.43355869, 2.49963220, 0.05861799, 1.73290589, 0.38153146, 0.24316978) ## No error m1 <- nlme(SLOPE ~ c + (d-c)/(1+exp(b*(log(DOSE)-log(e)))), fixed =
1999 Jul 20
2
tensor() function and sets
Hi Everyone, To complete the outer() and kronecker() functions in the base, may I suggest the following tensor() function, which allows the multiplication of arrays through sets of conformable dimensions. I am happy to write a help page if required. The code also needs a setdiff() function which prompts me to ask: what about simple set functions? I expect many of us have written our own
2011 May 07
1
spdep::poly2nb problem
I downloaded a US states+territories shapefile from http://www.weather.gov/geodata/catalog/national/html/us-state.htm and unzipped it into my working directory. Then in R (version 12.2.0 for ms-win32): library(rgdal) # Version: 0.6-28 library(spdep) # Version: 0.5-24 (loads sp: Version: 0.9-72) # read in the data states<-readOGR(".","s_01de10") summary(states) # now
2012 Jun 15
2
strings concatenation and organization (fast)
Hello, What is the fastest way to do this? I has to be done quite a few times. Basically I have sets of 3 numbers (as characters) and sets of 3 dashes and I have to store them in named columns. The order of the sets and the column name they fall under is important. The actual numbers and the pattern/order of the sets should be considered random/unpredictable. Sample data: vec =
2018 Feb 22
2
Duplicate column names created by base::merge() when by.x has the same name as a column in y
>>>>> Gabriel Becker <gmbecker at ucdavis.edu> >>>>> on Wed, 21 Feb 2018 07:11:44 -0800 writes: > Hi all, > For the record this approach isnt 100% backwards compatible, because > names(mergeddf) will e incompatibly different. Thatx why i claimed > bakcwards compatable-ish exactly. > That said its still worth considering
2018 Feb 20
3
Duplicate column names created by base::merge() when by.x has the same name as a column in y
Hi Frederick, It looks like I didn't overwrite the patch.diff file after the last edits. Here's the correct patch (attached and copied below): Index: src/library/base/R/merge.R =================================================================== --- src/library/base/R/merge.R (revision 74280) +++ src/library/base/R/merge.R (working copy) @@ -157,6 +157,14 @@ }
2012 Dec 17
2
Suggestion: 'method' slot for format.ftable()
Dear R-developers, I would like to suggest a 'method' slot for format.ftable() (see an adjusted 'format.ftable()' below, taken from the source of R-2.15.2). At the moment, format.ftable() contains several empty cells due to the way the row and column labels are printed. This creates problems (= unwanted empty columns/rows) when converting an ftable to a LaTeX table; see an
2007 Sep 29
1
templates with same name before extension are cached
Hi all, I was just wondering if this is the intended behavior. Here is my setup: controller def index respond_to do |f| f.xml { render :xml => true } f.html { render :layout => :none } end end In my views I have a file for each type index.herb index.xerb The first request I send is cached and interferes with the other one. For example, if I send an xml request
2018 Feb 18
2
Duplicate column names created by base::merge() when by.x has the same name as a column in y
Thanks Gabriel, I think your suggested approach is 100% backwards compatible Currently in the case of duplicate column names only the first can be indexed by its name. This will always be the column appearing in by.x, meaning the column in y with the same name cannot be accessed. Appending ".y" (suffixes[2L]) to this column means it can now be accessed, while keeping the current
2015 Apr 29
2
dimnames returned by function apply
Dear all, I noticed that the dimnames returned by apply are different in the new release. In the following example. The returned row-names are c(?S?,?T?), but shouldn?t they be c(?X?,?Y?) as in the old release? Best, Bernd >X = array(1:8, dim=c(4,2)) >dimnames(X) = list(c("A","B","C","D"),c("S","T")) >apply(X, 1, function(x)
2011 Feb 19
1
Accessing Package NEWS (NEWS.Rd)
Okay. So, after having spent quite some time never really tracking down why my package NEWS files were unacceptable to readNEWS(), I noticed that there was recent (to me anyway) development that allowed the NEWS to be done as an Rd file. Sweet! A more standard format... I converted a NEWS file in one of my unreleased packages to Rd format. checkNEWS() gave it a thumbs up. But then it went south.
2009 Feb 03
1
Automatic creation of columns in zoo object
Hello, everyone I have a question. Assume I have the following zoo object: me.la <- structure(c(1524.75, 1554.5, 1532.25, 1587.5, 1575.25, 1535.5, 1550, 1493.5, 1492.5, 1472.25, 1457.5, 1442.75, 1399, 1535.75, 1565.25, 1543.5, 1598.5, 1586.5, 1547, 1561.5, 1504.75, 1503.75, 1483.75, 1468.75, 1453.75, 1410, 1546.75, 1575.25, 1554, 1609, 1597.5, 1558.5, 1573, 1516.25, 1515.5, 1495, 1480, 1465,
2015 May 13
0
Why is the diag function so slow (for extraction)?
Along Luke's lines, would(n't) it be enough to look for existence of attribute 'class' to decide whether to dispatch or not, i.e. if c() is needed or not? Even without .subset(), there is a remarkable improvement. I think it's worth condition the code on dispatch or not. For example: [HB-X201]{hb}: svn diff diag.R Index: diag.R
2007 Jun 01
2
Getting names of objects passed with "..."
Is there a tidy way to get the names of objects passed to a function via the "..." argument? rbind/cbind does what I want: test.func1 <- function(...) { nms <- rownames(rbind(..., deparse.level=1)) print(nms) } x <- "some stuff" second <- "more stuff" test.func1(first=x, second) [1] "first" "second" The usual